I have been banging around trying to work out how to do this and hope you guys can shed a little light. I have a document (document a) which simply has an image in the header and a bookmark acting as an insertion point. I would then like to insert another document (document b) at that insertion point but would like to retain all the styles, formatting and fonts of document a.
Our code has two methods of inserting a document, neither of which seem to produce the desired result. We can insert a document on a section-by-section basis, which doesn’t retain the formatting or we can insert a document on a section-by-section, paragraph-by-paragraph basis, unfortunately this method doesn’t retain the columns…
I have attached code on both methods as well as the documents in question.
Thanks for your request. As I can see, your second method does the same as AppendDocument method. I checked with the following code and as I can see, the output looks as expected:
Document dst = new Document(@"Test001\document+a.doc");
Document src = new Document(@"Test001\document+b.doc");
src.FirstSection.PageSetup.SectionStart = SectionStart.Continuous;
I use the latest version of Aspose.Words for testing.