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

Free Support Forum - aspose.com

Append Word Documents & Ignore Formatting in Text Boxes during Import of One DOC into another DOC using C# .NET Code

I have a .doc document with some replacement codes in (I’m doing my own MailMerge using custom tags as I’m mimicking an existing system for the customer)

I do the replacement which is OK but as soon as I merge it into a new document the font size changes in all Text Boxes from Arial 11pt to Arial 12 pt.

I’m using C# and Aspose.Word version 19.11.10

The basic code is:
string dataDir = “d:\”;
string fileName = “Werbebrieftest.doc”;
Document doc = new Document(dataDir + fileName);
Document newDoc = new Document();
//Replament code here. This does not affect the formatting and have removed for shorter code.
newDoc.AppendDocument(doc, ImportFormatMode.KeepSourceFormatting);
dataDir = dataDir + “Werbebrieftest_out.doc”;

I have enclose the original document and the output.
It is the line with ##ADRESSE## which changes in the output from 11 pt to 12 pt.

Also, I am upgrading from a very old version of Aspose.Word (version 2.2) where this was not a problem.Archive.zip (16.1 KB)


We tested the scenario and have managed to reproduce the same problem on our end. For the sake of any correction, we have logged this problem in our issue tracking system. The ID of this issue is WORDSNET-19515. We will further look into the details of this problem and will keep you updated on the status of correction. We apologize for your inconvenience.

Looking forward to an update.


We have started the analysis of this issue to determine the root cause. We will inform you via this thread as soon as this issue will be resolved in future.


We have good news for you i.e. WORDSNET-19515 has now been resolved. The fix of this issue will be included in the 19.12 (next version) of Aspose.Words. We will inform you via this thread as soon as the next version containing the fix of your issue will be released at the start of next month.

So, starting from the next verion “19.12”, please use the following code to preserve formatting in textboxes:

string dataDir = @"d:\";
string fileName = "Werbebrieftest.doc";
Document doc = new Document(dataDir + fileName);
Document newDoc = new Document();

ImportFormatOptions options = new ImportFormatOptions();
options.IgnoreTextBoxes = false;
newDoc.AppendDocument(doc, ImportFormatMode.KeepSourceFormatting, options);

dataDir = dataDir + "Werbebrieftest_out.doc";

The issues you have found earlier (filed as WORDSNET-19515) have been fixed in this Aspose.Words for .NET 19.12 update and this Aspose.Words for Java 19.12 update.


Thank you for this solution. It worked on our project as well.

We have a question though. Why is the default value for IgnoreTextBoxes true instead of false? Also, what are the other implications of settings IgnoreTextBoxes to false? We’re concerned that setting it false might cause other issues.

Is there any way that we can unit test this? for example.

var doc1 = new Document();
var doc2 = new Document();
doc1.AppendDocument(doc2, ImportFormatMode.KeepSourceFormatting,  new ImportFormatOptions { IgnoreTextBoxes = false });

// assert that IgnoreTextBoxes is false after appending the document

It looks like the issue began at v18.2… That is, v18.1 doesn’t exhibit this issue during our testing/troubleshooting.

Thank you,


This is because MS Word also does not take into account the formatting difference in the text boxes while importing and Aspose.Words uses/copies the same MS Word’s behavior by default.

Please note that this setting affects only the TextBox content formatting during importing.

You may check for example the font size in problematic TextBox. It will be different depending on “IgnoreTextBoxes” setting.

Hope, this helps.

@awais.hafeez I see. Thank you so much for the immediate and detailed response. :slight_smile: