Hi,
Please use the code below, it should remove the last page break in a document.
NodeCollection runs = doc.LastSection.GetChildNodes(NodeType.Run, true);
// Find the runs that contain the last page break characters in this section and remove the character.
for(int i = runs.Count-1; i >= 0; i--)
{
Run run = (Run)runs[i];
if(run.Text.IndexOf(ControlChar.PageBreakChar) >= 0)
{
run.Text = run.Text.Remove(run.Text.IndexOf(ControlChar.PageBreakChar), 1);
break;
}
}
If you need any futher help then please feel free to ask.
Thanks,
Adam Skelton
Programming Writer
Aspose Auckland Team