> Hi =?Utf-8?B?R1YxOTU1?=,
>
> There is no "Page" object, just a Pages collection. From the Word Help:
>
> "Returns a Pages collection that represents the pages in a document.
>
> expression.Pages
> expression Required. An expression that returns a Pane object."
>
> Not much use in C#, which requires strict typing...
>
> > I am generating a report from the .NET C# Windows application by automating
> > Word 2003. The report works but I need to do some final formatting so that
> > certain blocks of text appear complete on the pages by adding some page
> > breaks. However, I cannot determine whyere to place the breaks until the
> > report is completely generated. The only way I can find to do this is using
> > the Page object. However, I cannot access the Page interface/object in
> > Microsoft.Office.Interop.Word. It is not listed in the reference and yet it
> > is documented in the Microsoft site.
> >
> Difficult to give you a "works the first time" recommendation without knowing
> the details of the reports, but I do agree with Doug. It's seldom a combination
> of paragraph-level formatting won't work to control this kind of thing.
>
> I'd try applying "Keep with next" formatting on all the paragraphs, including
> those in the table. Further, I'd set the table to not allow rows to break
> across pages. Then, I'd insert one "empty" paragraph mark immediately after the
> table where "Keep with next" is NOT activated. That should push everything to
> the next page, up through the following table, if it doesn't have room on the
> main page.
>
> And I'd probably use styles to apply the formatting, although it wouldn't be
> strictly necessary.
>
> The way you envision the task can be done but again, it's even more difficult
> to give a useable recommendation without knowing the exact details. In general
> sort of way, I'd check the page number of the first word of the first paragraph
> in a "block", then compare it to the page number of the last character in the
> table. If they're different, put a page break before the paragraph. I'd use
> ranges, so no need for a "Page" object. And the Range.Information function has
> parameters that return page information.
>
> > Thanks for the reply but that is not going to cut it for me. I am not dealing
> > with just a paragraph but a block of text (a couple of paragraphs and a
> > table, to be exact). I need to prevent these blocks from breaking up between
> > pages so I need to walk the pages and determine where to place my breaks. As
> > I mentioned before, I do not know how large these blocks will be until the
> > report is complete. Sometimes I can get three blocks in one page and other
> > times just two.
> >
> > Anyway, the bigger issue is why the MS documentation talks about a Page
> > object available in the Interop.Word PIA's when there is none.
> >
> > "Doug Robbins - Word MVP" wrote:
> >
> > > Word does not have much a concept of pages as it is dependent upon the
> > > printer that is active.
> > >
> > > You are probably better off to do what you are after by making use of the
> > > Page Break Before, Keep Together and Keep with Next attributes of the
> > > Paragraph object.
> >
>
> Cindy Meister
> INTER-Solutions, Switzerland
>
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
>
http://www.word.mvps.org>
> This reply is posted in the Newsgroup; please post any follow question or reply
> in the newsgroup and not by e-mail :-)
>
>