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

Free Support Forum - aspose.com

Word compare differences

Hello, I have problem with comparing functionality for below code I receive different result that I receive when I compare two documents directly in word

String par0 = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec hendrerit sapien non felis molestie sodales. Pellentesque tempus, diam vel vestibulum aliquam, purus neque pulvinar massa, a ullamcorper risus nunc quis lacus. Nunc sed ipsum vitae nibh molestie pellentesque sit amet quis ipsum. Pellentesque aliquet nunc vitae commodo molestie. Ut lacus diam, suscipit nec lacus vitae, commodo congue turpis. Duis augue sem, tempus feugiat neque vitae, venenatis cursus ante. Sed nec quam quam. Quisque porta nisi malesuada euismod maximus. Fusce ultrices ex in leo tincidunt volutpat. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Proin in ante sit amet sem vehicula sollicitudin.";
String par1 = "Quisque vel sapien id ante efficitur tincidunt. Suspendisse quis nisi ut tortor rutrum aliquam a eget nunc. Integer est nisi, vestibulum quis elementum non, tristique et tellus. Nullam justo justo, scelerisque a est eu, porttitor fermentum nunc. Vestibulum eros ex, pretium nec consectetur rhoncus, vestibulum quis sapien. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.";
String par2 = "Quisque egestas mauris a purus sollicitudin, sit amet semper erat sagittis. Sed hendrerit tincidunt vel sait in feugiat. Sed pharetra, tellus et feugiat sodales, tellus eros blandit quam, luctus sodales libero lectus vel dui. Duis sit amet sapien id ante efficitvestibulum, fringilla augue a, sagittis neque. Morbi ut lorem nulla. Nam justo massa, ultrices eget consectetur a, consequat nec lorem. Nunc viverra diam eros, sed gravida quam molestie nec. Morbi eu lacus euismod, ornare turpis sed, aliquet velit. Aliquam erat volutpat. Praesent sodales dolor mi, in lobortis nisi mattis eu. Praesent tempus eros eu sodales mattis. Interdum et malesuada fames ac ante ipsum primis in faucibus. Quisque id vehicula felis.";

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.writeln(par0);
builder.writeln(par1);

Document doc2 = new Document();
DocumentBuilder builder2 = new DocumentBuilder(doc2);
builder2.writeln(par0);
builder2.writeln(par2);
builder2.writeln(par1);

CompareOptions compareOptions = new CompareOptions();
compareOptions.setGranularity(Granularity.CHAR_LEVEL);

doc.save("a.docx");
doc2.save("b.docx");

doc.compare(doc2, " ", Calendar.getInstance().getTime(), compareOptions);
doc.save("comp.pdf");
doc.save("comp.docx");

Here is screen what I have as export result and what I have in compare in Word

image.png (132.9 KB)

Is this expected or this is some kind of bug or maybe I do something wrong?

@ANDREA.FARRIS Thank you for reporting the problem to us. For a sake of correction it has been logged as WORDSNET-24779. We will keep you informed and let you know once it is resolved.

Also, I have noticed that Aspose.Words produces the output similar to MS Word when Granularity.WORD_LEVEL is used.