We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

PageBreak not Occurring

Using the code below, a page break is not occurring between the text preceding the ControlChar.PageBreak and the text after it. Am I doing something obviously wrong?

Dim para As Aspose.Words.Paragraph = New Aspose.Words.Paragraph(wordDocument)
Dim run As Aspose.Words.Run = New Aspose.Words.Run(wordDocument)
run.Text = “Before Page Break…” & Aspose.Words.ControlChar.PageBreak & _
"After PAGE BREAK HERE (NodeIndex = " & NodeIndex & “)”
run.Font.Color = System.Drawing.Color.Red
para.AppendChild(run)
TableNodes(NodeIndex).ParentNode.InsertBefore(para, TableNodes(NodeIndex))
wordDocument.UpdatePageLayout() 'Necessary for added items to appear after call to GetStartPageIndex!

@JReynolds,

To ensure a timely and accurate response, please ZIP and attach the following resources here for testing:

  • Your simplified input Word document
  • Aspose.Words 19.4 generated output document showing the undesired behavior
  • Your expected document showing the correct output. You can create expected document by using MS Word.
  • Please also create a simplified standalone console application (source code without compilation errors) that helps us to reproduce your current problem on our end and attach it here for testing. Please do not include Aspose.Words DLL files in it to reduce the file size.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.