Free Support Forum -

Aspose.Words InsertDocument problem with Tab Indent

Hello Aspose, I am using DocumentBuilder.InsertDocument method to combine documents, but have different results with Word generated tests

In provided example all content from 'block.docx' file inserted into 'main.docx'.
'expected.docx' - result when we make Ctrl+A and Ctrl+C in block.docx' and Ctrl+V in 'main.docx' using Microsoft Word 2013.
'observed.docx' - result with wrong indent generated by Aspose.Words 17.4.0.
'example.cs' - C# code snippet to reproduce problem

*.xml files - and diff.png shows xml differences.

Could you fix InsertDocument behaviour to be same as Ms Word or provide a hint how to solve that?

Hi Daniel,

Thanks for your inquiry. We have tested the scenario with your shared document and noticed the reported issue. We have logged a ticket WORDSNET-15343 in our issue tracking system for further investigation and rectification. We will notify you as soon as it is resolved.

We are sorry for the inconvenience.

Best Regards,

Hi Daniel,

Thanks for your patience. We have investigated above reported issue and found it is not a bug. MS Word renders problematic paragraphs differently because source document has DoNotUseIndentAsNumberingTabStop compatibility option set to FALSE while created from scratch document has this option TRUE. You can set this option false to match source document or you can just optimize mainDoc for Word2007 or Word2013. Please check following code snippet, it will help you to get expected output.

var mainDoc = new
Aspose.Words.Document(Path.Combine(folder, “main.docx”));<o:p></o:p>

//mainDoc.CompatibilityOptions.DoNotUseIndentAsNumberingTabStop = false;


var blockDoc = new Aspose.Words.Document(Path.Combine(folder, "block.docx"));

var docBuilder = new DocumentBuilder(mainDoc);

docBuilder.InsertDocument(blockDoc, ImportFormatMode.UseDestinationStyles);


Please feel free to contact us for any further assistance.

Best Regards,


Indents looks much better when applying on of fixes, small shift exists when compare with MS Word result, but it is fine.

Hi Daniel,

Thanks for your feedback. It is good to know that you have managed to accomplish your requirements with the suggested code.

Please keep using our API and feel free to contact us for any further assistance.

Best Regards,