Posting this new topic in relation to this post.
Two Bullet points are coming for the lists inside a paragraph, when merging two words documents, using the doc.compare(doc1) api.
First I was converting original doc to html → editing the html in the html editor and saving it → and then converting this html into docx again → and finally comparing the original doc with this docx file.
So if I keep ignoreFormatting to true as shown below this issue appears. But this issue doesn’t appear if i dont set this ignoreFormatting property, which means by default it will be set to false.
Please suggest any workaround to eliminate this issue. This is coming only at the final compare and merge - “docB.compare(docA, “user”, new Date(), options);”.
Few Observations, why this issue is happening:-
- while converting from doc to html in the first place, some extra space gets added between the bullet point and starting character of the sentence in that line.
Attached the result.docx - which is a faulty output docx that is getting produced.result.zip (287.2 KB)
Document docB = new Document(“D:/original.doc”);
docB.acceptAllRevisions();
docB.save(“D:/Abc_converted.html”, SaveFormat.HTML); // Save the document in HTML format.
}
Document doc = new Document(“D:/Abc_converted.html”);
doc.save(“D:/updated.docx”, SaveFormat.DOCX);
Document docB = new Document("D:/original.docx");
Document docA = new Document("D:/updated.docx");
docA.acceptAllRevisions();
docB.acceptAllRevisions();
CompareOptions options = new CompareOptions();
options.setIgnoreFormatting(true);
options.setTarget(ComparisonTargetType.CURRENT);
docB.compare(docA, "user", new Date(), options);
docB.save("D:/result.docx",SaveFormat.DOCX);