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

Free Support Forum - aspose.com

document.importNode() changes number type for some paragraphs


Please use the attached document files in the following code. I use a template document to which I am adding content of 2 other documents. Number type of some paragraphs in the second document changes from “bullet” to “numbered” after it is inserted to the result document.

If the second document is inserted to the template alone (without the first document), all paragraphs are inserted correctly, with the correct number type.

Also, this does not happen with any documents/examples. The second document has been originally generated by Aspose API, where the style and list and indents were set for these paragraphs. After the document was generated, for the third paragraph in that document, I have manually set “List Bullet” style in Word. The appearance of the paragraph did not change, however, something changed that causes that the third paragraph is inserted correctly now to the template in the example below.

Here is the code:

Document doc = new Document( "src/data/clean-template.docx");
Document doc1 = new Document( "src/data/ numberlist.docx");
Document doc2 = new Document( "src/data/bullets.docx” );

Node docSection = doc1.getChildNodes(NodeType.SECTION, true).get(0);
doc.appendChild( doc.importNode( docSection, true ) );
docSection = doc2.getChildNodes(NodeType.SECTION, true).get(0);
doc.appendChild( doc.importNode( docSection, true ) );

OoxmlSaveOptions saveOptions = new OoxmlSaveOptions( SaveFormat.DOCX );
saveOptions.setCompliance( OoxmlCompliance.ISO_29500_2008_TRANSITIONAL );
doc.save("src/data/output.docx", saveOptions);

Any help in this matter would be appreciated.

If there is a way to use Aspose API to simulate the “style” assignment I did in Word for the third paragraph in the bullets.docx document the way that it would result in correct imported result, please let me know.

Thank you very much,


Hi Natasa,

Thanks for your inquiry. We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-14504. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

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