When formatting is done with track changes on, if the font is changed to size 12 the destination document will display it in size 10 font when using KEEP_SOURCE_FORMATTING. Other font sizes seem to work fine.
Document sourceDocument = new Document("source.docx");
Document destDocument = new Document();
NodeImporter importer = new NodeImporter(sourceDocument, destDocument, ImportFormatMode.KEEP_SOURCE_FORMATTING);
destDocument.getFirstSection().getBody().getFirstParagraph().remove();
Iterable<Node> nc = sourceDocument.getFirstSection().getBody().getChildNodes();
for (Node node : nc) {
Node dstNode = importer.importNode(node, true);
destDocument.getFirstSection().getBody().appendChild(dstNode);
}
destDocument.save("dest.docx");
dest.docx (7.9 KB)
source.docx (14.4 KB)
@faith113
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): WORDSNET-27678
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
Thanks Alexey. As a workaround KEEP_DIFFERENT_STYLES seems to work fine. From what I understand both KEEP_DIFFERENT_STYLES and KEEP_SOURCE_FORMATTING should produce accurate representations of the source document.
In my case I don’t think I see any harm in switching to KEEP_DIFFERENT_STYLES. It’s going to just bring in the new styles only if it can’t find an identical one.
I guess I’m not aware of any downsides of going from KEEP_SOURCE_FORMATTING to KEEP_DIFFERENT_STYLES, are there any?
@faith113 There should not be any problems in switching from KEEP_SOURCE_FORMATTING
to KEEP_DIFFERENT_STYLES
.
1 Like