How do I delete a page break?

I have a question on deleting a page break. I have a generated document which contains a page break followed by Section Break (new page). I want to delete this page break. How do I do that?

I use a Java version of Aspose.word.


Thanks for your request. Please attach a sample document. I will create sample code for you.
Best regards,

Here is the sample document. Maybe I did not explain well at first. Let me revise my question. How do I remove (or delete) a page without any content. Basically, there is a blank page with header and footer. But its body does not have any content in it. And the break type is PAGE_BREAK not SECTION_BREAK_NEW_PAGE.
Thank you.

Hi Michelle,
Thank you for additional information. You can try using the following code to remove all page breaks from the document.

// Save document
// Open document
Document doc = new Document("C:\\Temp\\sample.doc");
// Get collection of Runs from the document
NodeCollection runs = doc.getChildNodes(NodeType.RUN, true);
// Loop through all runs
for (int i = 0; i < runs.getCount(); i++)
    Run run = (Run)runs.get(i);
    // Remove PageBreak Character
    run.setText(run.getText().replace('\f', ' '));
// Save output document"C:\\Temp\\out.doc");

Hope this helps.
Best regards.

Thank you so much, Alexey. It works great!