Free Support Forum -

Empty page in generated in Word document


We use Aspose.Total for Java and have the follow issue:
1. Transform MS Word document to Word document as add new footer to the document:
- one empty page is added in the Word document.

Attach files for reproducing the problem and transformed Word which is broken.


Hi Ginka,

Thanks for your inquiry. Could you please share the following details for further investigation?

What environment are you running on?
  • OS (Windows Version or Linux Version)
  • Architecture (32 / 64 bit)
  • Please supply us with the code that you have used to add footer in Word document.

As soon as you get these pieces of information to us we'll start our investigation into your issue.

Hi Tahir,


  • OS: RedHat-6.0
  • Architecture: x86_64
  • Source code in attached file “Aspose Add Footer.txt”.

Best Regards,
Ginka Kyoseva

Hi Ginka,

Thanks for sharing the code.

Please note that Aspose.Words tries to mimic the same behavior as MS Word do. There is no “Page” concept in Microsoft Word documents. Pages are created by Microsoft Word on the fly.

Please try to add some more contents into the document’s footer by using MS Word. The height of footer become bigger and the contents flow to second page. Please see the attached image for detail.

There is an explicit page break after each table in your document (see the attached image). After growing the contents of footer, this explicit page break moves to next page and causes empty pages.

I suggest you, please remove such explicit page breaks from your document by using following code snippet. This solves your problem. Please read following documentation link for your kind reference.

<span style=“font-size:
10.0pt;font-family:“Courier New”;color:#2B91AF;mso-no-proof:yes”>Document<span style=“font-size:10.0pt;font-family:“Courier New”;mso-no-proof:yes”> doc = new Document(MyDir

  • “in.docx”);<o:p></o:p>

addWordFooterWithTabStop2(doc, "");

removePageBreaks(doc); + "out.docx");

private static void removePageBreaks(Document doc) throws Exception


// Retrieve all paragraphs in the document.

NodeCollection paragraphs = doc.getChildNodes(NodeType.PARAGRAPH, true);

// Iterate through all paragraphs

for (Paragraph para : (Iterable) paragraphs)


// If the paragraph has a page break before set then clear it.

if (para.getParagraphFormat().getPageBreakBefore())


// Check all runs in the paragraph for page breaks and remove them.

for (Run run : (Iterable) para.getRuns())


if (run.getText().contains(ControlChar.PAGE_BREAK))

run.setText(run.getText().replace(ControlChar.PAGE_BREAK, ""));