Category: Uncategorized

MS Word Basics: Outlining and TOC

This might seem like a relatively non-technical topic compared with the other posts on my blog, but I suspect these tips will be useful to somebody!  One of my reasons for keeping a blog is to record instructions for processes that I’ve had to explain more than once, and there are a few MS Word tricks which can save you a lot of time.

Images are from Word 2013, but the processes are similar with any version of Word.  Click on them to see a larger version.

Use the Built-in Styles

You need to use Header 1, Header 2 etc., when creating titles for your document.   These techniques will not work otherwise.  If you need more convincing, here’s a thorough post on the subject.

One great thing about the built in styles is that MS Word has shortcuts for them:
Control-Alt-1 applies heading 1, etc.   This makes reorganization of your document incredibly easy.

Creating an “Outline Document”

You might want to number the sections of your document to look like an outline. For example:
Numbered Headers
This is most easily done by assigning numbering to your headers, and using them as titles for the sections of your document.  This approach also plays well with the Table of Contents, also covered below.

  1. Click the Multilevel List button on the Home Tab.
    Multilevel List button
  2. Here’s a nice trick (optonal):  Select the list library which looks most similar to the outline that you want.  That will be your starting point.  You’ll have to click the Multilevel List button again.
  3. At the bottom of this dialog, select Define a new Multilevel List
    Define a Multilevel List
  4. Click on the More button to see the entire Define new Mutlilevel List dialog
  5. Let’s say you want a two-level outline.
    In the left of the dialog where you see Click level to modify, click on 1.  On the right where it says Link level to style, click on Heading 1.    Do the same for level 2.  
    Define a Multilevel List
  6. Click OK.  Word will automatically modify the appropriate styles.

Don’t like it?  Control-Z will undo the whole thing!

Table of Contents

  1. First position your cursor at the beginning of the Document, after the title page, or wherever you want your TOC to be.
  2. You will probably want the table on its own page.  This is also important because the table itself takes up room.  If so, Control-Enter will give you a page break.
  3. The trickiest part of this is finding the button – look on the References Tab:TOC button
  4. Once the table is in your document, you will need to tell it when to update.  Just click on it and and an Update Table button will pop up in the upper left. Update Table Button
  5. (Optional) You can also customize your table of contents, applying styles or telling Word how many levels to show.  Click the Table of Contents button and select Custom Table of Contents from the dropdown.

Help, I messed up my styles!

Let’s say you’ve changed your header styles and want to go revert to the Word default.  Use the following process to locate the Normal Template file, which you can then delete or rename.  MS Word will recreate it when restarting. Note that you will lose other custom settings too, like keyboard shortcuts.  Fortunately you can always go back, using creative file naming!

  1. Shut down MS Word.
  2. Open a file explorer (or “My Computer”) and paste the following into the window at the top: %appdata%\Microsoft\Templates, and hit return.
  3. Find the file Normal.dotm and rename or delete it.
  4. Restart MS Word.

NLog Database Configuration

When using NLog on web sites (most notably in SharePoint or in HttpModules), I’ve noticed some problems with file logging. So I found myself looking for a good database configuration which matches some basic needs. I settled on the following:

In the web.nlog file:

<?xml version="1.0" encoding="utf-8"?>
<!-- This section contains the NLog configuration settings -->
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <targets>
    <target name="database" type="Database"> 
      <connectionString> 
        Data Source=localhost; Integrated Security=SSPI;Initial Catalog=MyDatabase 
      </connectionString> 
      <commandText> 
        insert into system_logging(log_date,log_level,log_logger,log_message, log_message_id, log_user_name, log_call_site, log_thread, log_exception, log_stacktrace) values(@time_stamp, @level, @logger, @message,@msgid, @user_name, @call_site, @threadid, @log_exception, @stacktrace); 
      </commandText> 
      <parameter name="@time_stamp" layout="${longdate}"/> 
      <parameter name="@level" layout="${level}"/> 
      <parameter name="@logger" layout="${logger}"/> 
      <parameter name="@message" layout="${message}"/> 
      <parameter name="@msgid" layout="${event-context:item=UniqueCode}"/> 
      <parameter name="@user_name" layout="${windows-identity:domain=true}"/> 
      <parameter name="@call_site" layout="${callsite:filename=true}"/>
      <parameter name="@threadid" layout="${threadid}"/> 
      <parameter name="@log_exception" layout="${exception}"/> 
      <parameter name="@stacktrace" layout="${stacktrace}"/>
    </target> 
  </targets>
 
  <rules>
    <logger name="*" minlevel="Trace" writeTo="database"/>
  </rules>
</nlog>

Here’s the script to create the necessary table:

USE [MyDatabase]
GO
/****** Object:  Table [dbo].[system_logging]    Script Date: 10/14/2014 2:06:10 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[system_logging](
	[system_logging_guid] [uniqueidentifier] ROWGUIDCOL  NOT NULL,
	[entered_date] [datetime] NULL,
	[log_application] [varchar](200) NULL,
	[log_date] [varchar](100) NULL,
	[log_level] [varchar](100) NULL,
	[log_logger] [varchar](8000) NULL,
	[log_message] [varchar](8000) NULL,
	[log_message_id] [varchar](8000) NULL,
	[log_user_name] [varchar](8000) NULL,
	[log_call_site] [varchar](8000) NULL,
	[log_thread] [varchar](100) NULL,
	[log_exception] [varchar](8000) NULL,
	[log_stacktrace] [varchar](8000) NULL,
 CONSTRAINT [PK_system_logging] PRIMARY KEY CLUSTERED 
(
	[system_logging_guid] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
ALTER TABLE [dbo].[system_logging] ADD  CONSTRAINT [DF_system_logging_system_logging_guid]  DEFAULT (newid()) FOR [system_logging_guid]
GO
ALTER TABLE [dbo].[system_logging] ADD  CONSTRAINT [DF_system_logging_entered_date]  DEFAULT (getdate()) FOR [entered_date]
GO