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

Free Support Forum - aspose.com

NodeImporter: Issue or as Designed?

I am seeing something with the NodeImporter that I am not sure if it is intended functionality or if it is a defect. In our previous release when this functionality was initially developed, using an earlier version of Aspose Words we were not seeing this issue.
Document one is a mini template of content. It contains 2 custom xml parts that we embed as a part of the user working with it.
Document two is a collection of mini templates. It also has 2 custom xml part that we embed as part of a user working with it.
When a user updates the content of document one and commits those changes it triggers a refresh of document two.
We use the NodeImporter to take the content node from document one and import them into document two. The problem I am seeing is after Document ones nodes are imported into document document two the custom xml parts from document one are also getting added to document two. This is not desired as we only one the content from document one.
We are currently using Aspose Words for Java 15.10.0. I plan to upgrade to the latest version of Aspose Words in our next software release. While I have not tested this issue with the latest Aspose release yet I want to understand if the custom xml parts coming over to document two is intended?
Code sample:

NodeImporter importer;
    importer = new NodeImporter(newClauseVersion, importToWordDocument, ImportFormatMode.USE_DESTINATION_STYLES);
    for (CompositeNode <?> node : nodesToImport)
        CompositeNode <?> importMe = (CompositeNode <?>) importer.importNode(node, true);
        CompositeNode <?> appendToNode = null;
        if (replaceMe.getLevel() == MarkupLevel.CELL)
            appendToNode = (Cell)replaceMe.getFirstChild();
            appendToNode = replaceMe;
        // Apply the primary list to the import nodes so they remain numbered correctly....in theory, cross fingers etc....
        if (importMe instanceof Paragraph)
            Paragraph p = ((Paragraph)importMe);
            if (applyThisList != null && p.getListFormat().isListItem())
                // only apply a list format if we found one and the current paragraph is already a list item. Assumption is that we have a single list to apply to our doc structure.
catch (Exception e)


Thanks for your inquiry. To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your first Word document
  • Your second Word document
  • Aspose.Words generated DOCX file showing the undesired behavior
  • Your expected document. We will investigate the structure of your expected document as to how you want your final output be generated like. You can create expected document using Microsoft Word.
  • Please create a standalone Java application (source code without compilation errors) that helps us reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we’ll start further investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip them and Click ‘Reply’ button that will bring you to the ‘reply page’ and there at the bottom you can include any attachments with that post by clicking the ‘Add/Update’ button.

Best regards,

Attached are artifacts to allow you to evaluate this issue.

DocumentOne is being imported into DocumentTwo and will result as DocumentTwoPostNodeImport. Included are the files as I have run the java program. DocumentTwoPostNodeImport contains the custom xml parts from DocumentOne.

DocumentTwoExpected is what I would expect to be happening. I need to understand if there is a way to prevent DocumentOne’s custom xml parts from getting imported or if this is an bug that needs to be address.

I ran my test using Aspose Words 16.2.0.



Thanks for the additional information. We tested the scenario and have managed to reproduce the same problem on our end. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-13394. Our product team will further look into the details of this problem and we will keep you updated on the status of correction. We apologize for your inconvenience.

Best regards,


Regarding WORDSNET-13394, our product team has completed the work on your issue and has come to a conclusion that they won’t be able to implement the fix to your issue. Your issue (WORDSNET-13394) will be closed with ‘Won’t Fix’ resolution.

The problem occurs because If an importing SDT is bound to a part, and a part with same ID does not exist in a destination document, then all missing document parts are imported from a source document.

Your source and destination documents have no custom XML parts with same ID, so it is correct that they are imported. It is not a bug, but expected behavior.

Aspose.Words cannot presume how custom XML parts are mapped in a source and a destination documents if they have different IDs. So unfortunately, we cannot implement as per your expectations.

Possible solution. We suggest you either make IDs same in related parts of the source and the destination documents or temporarily change the StructuredDocumentTag.DataBinding.StoreItemId property of an importing SDT to necessary value before import. Hope this helps.

Best regards,