"Grenier" wrote:
> Automating a word report. the TOC can take the space of 1 to 3 pages long.
> I'm looking for the correct way to insert the TOC on page 3 of the report.
>
> When I build the report, I leave page 3 empty (sectionbreak in top of page)
> , set all the toc field in the following pages and once done, I return or
> goto page 3 and then add the TOC. The problem that I have is with the footer
> of pages containing the TOC. If the TOC has just one page, the footer is OK.
> If the TOC has 2 or more pages, the footer is not repeated. (probably because
> no section break ?) here's the step I coded...
>
> .DifferentFirstPageHeaderFooter = True
> page1 :no footer
> page2 :add custum footer, wdHeaderFooterFirstPage, LinkToPrevious=false
> page3 : insert TOC, wdHeaderFooterPrimary, LinkToPrevious=true
> ...suppose toc is 3 pages long
> page4 : no footer
> page5 : no footer
> page6 : add custum footer, wdHeaderFooterFirstPage, LinkToPrevious=false OK
>
> How can I get a footer on page 4 and 5. Can I force footer to appear on each
> page instead of each section cause the problem here is that the section is 3
> pages long.
> Maybe it's not the way to do it ? and hoping I'm clear...
It looks as though you are using a TOC section that is preceded by 2
sections. Each of the first two sections have only one page, but are using
the "First Page Different" footer/header setting? Why?
If you have only one page in a section and do not intend to have more pages
in those sections (or do not need a different first page footer), do not use
that setting. As is, when you add page 2 and following in the third section
(TOC), Word uses the section 3 primary footer, which by default is linked to
the one from the previous section (Even if the First page footer is not
linked, the primary one can be, and will be by default until you set it
otherwise).
Now, because (I guess) you have never set the primary footer in sections 1
and 2, the primary footer in section 3 is empty becasue it is linked to an
empty primary footer. The easiest way out of your "predicament", is to go
back and redefine your approach.
Sections 1, 2 and 3 do not need a "First Page Different" setting. Remove
that setting from the first three sections, use only the primary footer,
unlink them all and set the content as you do now. From section 4 onward, if
you have Chapter Tile pages (or something similar) then you may use a "First
Page Different" setting, otherwise, don't!
Alternatively, you could eliminate section 2 and place the TOC in section 2.
Section 1 would be two-page long. Now you could use "First Page Different" in
section 1, but not in 2. Keep the first page footer in section 1 empty, the
first primary footer in section 1 as you wish. Then, in section 2 (TOC), do
not use the "First Page Different" setting and unlink the primary footer
before setting the content as you wish. Your document would start in section
three, also with its footers unlinked, I guess.
Too often I have wasted hours reformatting a 200-300 hundred-page document
that was all messed up because section breaks had been inserted willy-nilly,
and First Page/Odd-Even Different was used for no valid eason, making the
management of the editing atrocious... Don't create a future headache by
using settings that you do not need.
As the saying goes, K.I.S.S., no, not the rock band or an emotional
response... Keep It Short and Simple.