Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / November 2006

Tip: Looking for answers? Try searching our database.

Automation in C# (Page Break)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Amrish - 16 Nov 2006 12:10 GMT
Hi, I am generating the TOC of a document using C# by pointing the Range to
the BookMark which i had placed manually on the start of page2. But if my TOC
fills only half the page, then actual contents start fromt he very same page
below the TOC. Is there any way to check if the TOC and actual contents are
present in the same page and if so can we manually include a Page Break?

Could it be Something like this? If so is there a syntax to get the page
number of the selection?

If( PageNumberOf(TOC) == PageNumberOf(Actual Document Contents))
{
          Insert Manual Page Break;
}

Or is there any other way to handle this?

-Amrish
Shauna Kelly - 19 Nov 2006 11:41 GMT
Hi Amrish

I think you're trying to re-invent the wheel here.

Am I right in understanding that your document consists of:

- some text on page 1
- a Table of Contents
- some more text that you want to start on a new page.

If that's so, then format the text after the TOC with "Page Break Before".
That is, Format > Paragraph. On the Line and Page Breaks tab, tick the "Page
Break Before" box.

By the way, manual page breaks are almost always a bad idea. And, it's
generally a good idea to leave one empty paragraph between the TOC and any
subsequent text.

Hope this helps.

Shauna Kelly.  Microsoft MVP.
http://www.shaunakelly.com/word

> Hi, I am generating the TOC of a document using C# by pointing the Range
> to
[quoted text clipped - 17 lines]
>
> -Amrish
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.