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

Free Support Forum - aspose.com

Remove blank page from end of document

How can I remove the blank page at the end of the attached WORD document?

Hello

Thanks for your request. Actually there is no blank page. The last page contains the table row from previous table. To remove this page you should refactoring your document using MS Word.

Also Word document is flow document and does not contain any information about its layout into lines and pages. Therefore, technically there is no “Page” concept in Word document.

Best regards,

Thanks for the quick response.

What you mean by “refactor using MS WORD”.

I am using the DocumentExplorer sample application to view the nodes of the word document. I only see one blank row at the end of the last table. I remove it using the DocumentExplorer tool and there still seems to be some extra spacing that is causing an extra page to show when rendered. Would the SectionBreak in the final paragraph cause an extra page to show when rendered? If so, how can i get rid of that last SectionBreak in the last paragraph?

Hello

Thanks for your inquiry. I mean you should open your document in MS Word and modify. I sent the modified document (without last page) to your e-mail.

Also there is no any SectionBreak, but just paragraph. This paragraph cannot be removed because Table cannot be last node of Word document section.

Best regards,

Thanks for the info.

Unfortunately, the word document I am modifying is generated from SSRS 2008. So I need to be able to correct this issue programmatically if I can. I can’t manually open the Word document to fix the table problem. Any suggestions?

Hello

Thank you for additional information. Unfortunately I cannot suggest you any direct way to remove the last page of your document programmatically. But if it is acceptable for you, you can try playing with tables using for example the following code:

Document doc = new Document("AmendmentPackage.doc");
Node[] tableColl = doc.GetChildNodes(NodeType.Table, true, true).ToArray();
((Table)tableColl[25]).LastRow.Remove();
doc.Save("out.doc");

This code removes the empty row from the table.

This approach does not fit your needs but maybe helps you to find some solution.

Best regards,