I am merging multiple documents together into a single document using AppendDocument(). I wish to avoid page-breaks between documents, and so on the second document I set the SectionStart to be SectionStart.Continuous.
However, the formatting on the last-line from the first paragraph changes. In the original document, the paragraph is fully justified. But the text on the last line is not long enough to be fully justified, so the last line remains left justified. This is the desired affect. (see attached screen shots)
When I append the 2nd document to continue from the end of the first, the justification on that last-line changes to be fully justified. This results in huge gaps/white space on the last line, and is not desirable.
This behavior can be reproduced in Aspose by doing the following:
new Aspose.Words.License().SetLicense("Aspose.Total.lic");
var doc = new Document("first.doc");
var doc2 = new Document("second.doc");
doc2.LastSection.PageSetup.SectionStart = SectionStart.Continuous;
doc.AppendDocument(doc2, ImportFormatMode.UseDestinationStyles);
doc.Save("result.doc");
I have attached my sample documents that are referenced in this code. This behavior can also be reproduced directly in word by doing the following:
- Enter a paragraph of text, and set to fully justified. Keep the last line short enough to not fully justify
- At the end of that paragraph, do an Page Layout -> Breaks -> Continuous, and you’ll get a newline but the justification will have changed.
- You can “undo” this format change by going to the end of the changed line, and simply hitting “enter”. It will clear the format change but keep the newline below. I have tried mimicking this behavior from Aspose but have not been successful.
Are there any recommendations for combining 2 documents in a continuous fashion (no page breaks), but leave the formatting of the paragraphs alone?