i am using below code to export the document in word file. but the issue is when i export this then it is adding extra blank page in between two word pages. can you please suggest a solution of below code ?
Document Doc = new Document(stream);
Table table = Doc.FirstSection.Body.Tables;
foreach (Cell cell in table.GetChildNodes(NodeType.Cell, true))
foreach (Paragraph para in cell.Paragraphs)
if (!(cell.ParentRow.IsLastRow && para.IsEndOfCell))
para.ParagraphFormat.KeepWithNext = false;
Please ZIP and attach your input Word document and Aspose.Words generated output document showing the undesired behavior here for testing. We will then investigate the issue on our end and provide you more information.
please find attached requested data. let me know if you need more information
aspose.zip (17.4 KB)
In this case, you can simply remove the empty paragraph after the Table to remove the empty Page. Please check this code:
Document doc = new Document("E:\\Aspose\\test111156655_490b1c738f984668b27310d938d9fb81.doc");
Table tab = doc.FirstSection.Body.Tables;
tab.NextSibling.Remove(); // remove empty paragraph
Hope, this helps.
Table tab = doc.FirstSection.Body.Tables; // can you please explain what this will do ?? and where does it fit in my code ?
Please open your document with MS Word, you will see there is an empty paragraph after fourth table which is causing the blank page issue. This code will remove that paragraph to get the desired output. Hope, this helps.