Page break in MS Word where no paragraphs

K

Kristijan Marin

HI,

Have anyone tried inserting page break when there are no paragraphs on the
page ?

Well I have two TextBox and one Picture object and when i try to insert page
break it
happens not exactly where I have expected it . I would expect or need it
after the last inserted object ....

I don't even know what to set for Range ....

object range = aDoc.Range(ref s1,ref s2);

object start = Word.WdSectionStart.wdSectionNewPage;

aDoc.Sections.Add(ref range, ref start);

Thanks.

Kris
 
K

Kristijan Marin

I tried to read the Doc file that Word creates and it seams like i need to
create paragraphs for all the lines until i get to the object i've putted in
.....

Is this all that necessary ?

Kris
 
C

Cindy M.

Hi Kristijan,
Have anyone tried inserting page break when there are no paragraphs on the
page ?
Word requires at least ONE paragraph on a page.

Graphics objects are always anchored to a paragraph (a range). If there's only
one paragraph on a page, all graphics on the page will be anchored to that
paragraph.

What you probably need to do is:
- create two paragraphs on the page where you place the graphics
- set the Anchor parameter to the first of those paragraphs
- force the page break at the second paragraph

That should leave the one paragraph with the graphics on the original page.
Well I have two TextBox and one Picture object and when i try to insert page
break it
happens not exactly where I have expected it . I would expect or need it
after the last inserted object ....

I don't even know what to set for Range ....

object range = aDoc.Range(ref s1,ref s2);

object start = Word.WdSectionStart.wdSectionNewPage;

aDoc.Sections.Add(ref range, ref start);

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 :)
 

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