Problen in adding a PageBreak in word doc file if it has a Frame

If a doc file has a Frame as first element on first page. Now DocumentBuilder.MoveToDocumentStart() moves cursor in the Frame. So i can not add PageBreak in actual doc file.

If a doc file has a Frame as first element on first page. Now DocumentBuilder.MoveToDocumentStart() moves cursor in the Frame. So i can not add PageBreak in actual doc file
This message was posted using Aspose.Live 2 Forum

Hi

Thanks for your request. Could you please attach your document here for testing? I will check the issue and provide you more information.
Why do you need page break at the beginning of the document? If it is really necessary, you can just insert an empty paragraph at the beginning of the document and insert pagebreak into this paragraph. Your code, in this case, will look like the following:

Document doc = new Document(@"Test001\in.doc");
DocumentBuilder builder = new DocumentBuilder(doc);
// Create an empty paragraph and insert it at the beginning of the document.
Paragraph par = new Paragraph(doc);
doc.FirstSection.Body.PrependChild(par);
// Move cursor to the beginning of the document and insert pagebreak.
builder.MoveToDocumentStart();
builder.InsertBreak(BreakType.PageBreak);
doc.Save(@"Test001\out.doc");

Hope this helps.
Best regards.