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

Free Support Forum - aspose.com

NodeImporter removes shapes from source document (17.6)

Hi Aspose


Migrating from 15.4 to 17.6, the NodeImporter changed it’s behaviour. It now seems to remove Nodes from the source document… please consider the following code and find the required templates attached.
public static void main(String[] args) throws Exception {
final Document template = new Document(new FileInputStream(“Template.docx”));
final Document library = new Document(new FileInputStream(“Library.docx”));

library.setNodeChangingCallback(new INodeChangingCallback() {
@Override
public void nodeInserting(final NodeChangingArgs nodeChangingArgs) throws Exception {
throw new RuntimeException();
}

@Override
public void nodeInserted(final NodeChangingArgs nodeChangingArgs) throws Exception {
throw new RuntimeException();
}

@Override
public void nodeRemoving(final NodeChangingArgs nodeChangingArgs) throws Exception {
throw new RuntimeException(“Node removing is not allowed!”);
}

@Override
public void nodeRemoved(final NodeChangingArgs nodeChangingArgs) throws Exception {
throw new RuntimeException();
}
});

final NodeImporter importer = new NodeImporter(library, template, ImportFormatMode.USE_DESTINATION_STYLES);
final Node child = library.getChild(NodeType.SHAPE, 0, true).getParentNode();
final Node paragraph = template.getChild(NodeType.PARAGRAPH, 0, true);
paragraph.getParentNode().insertBefore(importer.importNode(child, true), paragraph);
}

Hi there,


Thanks for your inquiry. We have tested the scenario with your shared documents and noticed the reported issue. We have logged a ticket WORDSJAVA-1608 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,

@RanchlerRabbit,

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