Append Word documents into 1

Is it possible to append a Word document to the end of another to create a single document? For example, I have 2 Word templates A and B. I need to create a document containing 1 copy of template A and 2 copies of template B, maintaining all the formatting within these templates.
I’ve looked into copying all the data manually but the component cannot only extract plain text from sections, so this is not an option.

Cheers,

Haydn

It is surely possible to copy sections between different documents, see Sections and Section classes in the API documentation. Also, see the Product Catalog demo in the project included with Aspose.Word installer. There are also some code examples here in the forums that show how to copy and move sections between documents.

I have tried the following

Document destDoc = new Document(“doc1template.doc”);
Document srcDoc = new Document(“doc2template.doc”);

foreach (Section s in srcDoc)
{
Section s2 = s.Clone();
destDoc.Sections.Add(s2);
}

destDoc.Save(…);


This causes a couple of problems: 1. there is garbage text in the resulting file and 2. the font is incorrect for the inserted sections.

Are these bugs or just evaluatoin features?

The garbage text is part of the evaluation version watermark:

The font is probably incorrect because there are styles with the same name but with different formatting, see this

Hmmm. Interesting reading about the watermark for evaluation versions. Surely having to check if its the licensed version or not as to whether to insert random text will affect performance? Why not just keep the red text stating this is the evaluation version and just restrict the saving options to one of them only?

Or better still, have an evaluation version and non-evaluation version of the software?

Haydn

Thanks, but so far it works well for us and most of the customers.

The performance penalty is not noticeable because the check is only performed when you save.

We have to use random text because standard red text at the top can be removed if saving in HTML or when converting to PDF formats.