chpaters and templates

P

Paul Andews

I know how to use a built in heading style to create
chapter numbers, but I want to do this across a number of
word files that make up my whole document and use a common
(not normal.dot) template to control their appearance. If
I do this they all get the chapter number set in the
template, based on the heading style numbering. I could
turn off automatic style update in the template add-in but
this defeats the object. any one got any ideas how to do
this, please?
 
B

Bruce Brown

Hi, Paul -

One way to do this would be to put a hidden LISTNUM field at the top
of the template that will enable you to start the chapter number for
each file by hand.

Assuming that each file starts with a chapter number, it would go like
this:

* On your template, click the ShowAll paragraph mark on the Standard
toolbar.

* At the top of the template, put in the Heading 1 style for chapter
1, followed by xxx.

* Repeat, so the top of the template now looks like:

Chapter 1. xxx
Chapter 2. xxx

* Delete the xxx from Chapter 1.

* Replace the xxx with a LISTNUM field - Ctrl-Alt-L.

* Toggle the field codes twice - Alt-F9, Alt-F9.

* Inside the LISTNUM field, add the level and start switches as shown,
being careful that there's no space after either slash:

Chapter 1. { LISTNUM \L 1 \S 0 }

* Add a few spaces between the end of the LISTNUM field and the
paragraph mark.

* Select the whole paragraph and apply hidden font.

* Now click the ShowAll paragraph mark again so everything is hidden.
The first line disappears, and you should see only:

Chapter 1. xxx

CAREFUL!!! To change the chapter title for each new file, delete the
xxxs from the paragraph mark backwards toward the first x. If you
start with the first x you will be in the hidden paragraph above. To
avoid any mistakes, use ShowAll while setting the start number for the
LISTNUM field.

* Each time you create a new file, using ShowAll you simply change the
number in the \S switch to a number one below the one you want to
start at.

Simple. Crude. But always works. - Bruce
 
B

Bruce Brown

Paul - My suggestion IS to use the built-in Heading style (presumably
Heading 1) for the chapter numbers, and that will put in page numbers
prefixed by the Chapter number and a dash -- in headers/footers, TOC
and index.

To put in the chapter number before the page number in the footer, on
the header/footer toolbar click the third icon from the left, the one
with the hand holding the number sign, and check the Include chapter
number checkbox. Then the Heading 1 number will precede the page
number throughout the whole section, also in any Table of Contents or
cross-indexing based on those pages. - Bruce
 
B

Bruce Brown

Paul -

Sorry, I forgot an easier way to re-start the Heading 1 value across
multiple files created from the same template.

You put this macro in the template:

Sub AutoNew()
Dim L As ListTemplate, StartNo As Integer
StartNo = InputBox("Start chapter numbering at:", "Start Chapter
Numbering")
For Each L In ActiveDocument.ListTemplates
If L.OutlineNumbered And L.ListLevels(1).LinkedStyle = "Heading 1"
Then
L.ListLevels(1).StartAt = StartNo
Exit For
End If
Next
Selection.Style = ActiveDocument.Styles("Heading 1")
End Sub

Every time you create a new doc from the template it asks what chapter
number you want to start at, then puts in the Heading 1 style for you.

There are very straightforward ways to do this.

By using the Format page number icon on the header/footer toolbar (the
hand, third from left) you include the chapter number before the page
number, which can only be done with the built-in Heading sytles.

Building a TOC from multiple files is actually quite simple, and it's
easiest when they're all in the same folder. You use an RD
(Referenced Document) field for each file you want to reference.
Examples:

{ RD "Chapter1.doc" \f )
{ RD "Chapter2.doc" \f }

where the \f switch means all these docs are in the same folder. If
not, just spell out the whole path and doc name and don't use the \f
switch, but be careful to use double slashes as shown below:

{ RD "c:\\My Documents\\Chapters\\Chapter1.doc" }

Then you put in a TOC field like this:

{ TOC \f \h \z \t "Heading1,1" }

You can do the same thing for Indexes using the RD field.

You may want to make the TOC/Index file a separate file altogether.

- Bruce
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top