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;
try
{
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();
}
else
{
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.
p.getListFormat().setList(applyThisList);
}
}
appendToNode.appendChild(importMe);
}
}
catch (Exception e)
{