Spire.Doc for Java 14.7.0 enhances the Word document comparison feature

2026-07-03 07:18:52

We're pleased to announce the release of Spire.Doc for Java 14.7.0. This version introduces new CompareOptions configuration options and adds support for the "Two Lines in One" feature. Moreover, several issues encountered during the conversion of Word to PDF and HTML have been successfully fixed. More details are listed below.

Here is a list of changes made in this release

Category ID Description
New Feature SPIREDOC-8865 SPIREDOC-11824 SPIREDOC-10144 Added setIgnoreFields and setIgnoreCaseChanges configuration options to the CompareOptions class. Renamed setIgnoreTable(boolean value) to setIgnoreTables(boolean value). Renamed the corresponding getter getIgnoreTable() to getIgnoreTables().
Document doc1 = ConvertUtil.GetNewEngineDocument();
doc1.loadFromFile(inputFile_1);
String[] name1 = new String[]{"DJG_Black_Book", "DJG_Repairs_Expense", "DJG_Sale_Amount", "DJG_Dealer_Payment", "DJG_Auction_Fees"};
String[] value1 = new String[]{"20,000.00", "2,000.00", "13,500.00", "1,000.00", "500.00"};
doc1.getMailMerge().execute(name1, value1);
doc1.isUpdateFields(true);

Document doc2 = ConvertUtil.GetNewEngineDocument();
doc2.loadFromFile(inputFile_2);
String[] name2 = new String[]{"DJG_Black_Book", "DJG_Repairs_Expense", "DJG_Sale_Amount", "DJG_Dealer_Payment", "DJG_Auction_Fees"};
String[] value2 = new String[]{"50,000.00", "5,000.00", "3,500.00", "1,000.00", "200.00"};
doc2.getMailMerge().execute(name2, value2);
doc2.isUpdateFields(true);

CompareOptions options = new CompareOptions();
//set 'Moves'
options.setCompareMoves(true);
//set 'Case Changes'
options.setIgnoreCaseChanges(true);
//set 'Comments'
options.setIgnoreComments(true);
//set 'Fields'
options.setIgnoreFields(true);
//set 'Footnotes'
options.setIgnoreFootnotes(true);
//set 'Tables'
options.setIgnoreTables(true);
//set 'Textboxes'
options.setIgnoreTextboxes(true);
doc1.compare(doc2, "user", new Date(), options);
doc1.saveToFile(outputFile, FileFormat.Docx_2013);
doc1.close();
doc2.close();
New Feature SPIREDOC-11975 Added support for the "Two Lines in One" feature.
Document doc = ConvertUtil.GetNewEngineDocument();
Section section = doc.addSection();
section.setTextDirection(TextDirection.Right_To_Left);
Paragraph titlePara = section.addParagraph();
titlePara.appendText("===== FarEastLayout Two-Lines-in-One Full Scenario Test =====\n\n");

titlePara.appendText("\n\n1. Basic Two-Lines-in-One: ");
// Basic Two-Lines-in-One Combine=true, no brackets, no vertical layout
Paragraph p1 = section.addParagraph();
TextRange farEastLayout = p1.appendText("Basic Two-Lines-in-One: One Two Three Four");
farEastLayout.getCharacterFormat().setFontSize(12);
farEastLayout.getCharacterFormat().setFontNameFarEast("Songti");
FarEastLayout layout1 = new FarEastLayout();
layout1.setCombine(true); // Two-Lines-in-One
farEastLayout.getCharacterFormat().setFarEastLayout(layout1);

// Two-Lines-in-One + various bracket styles
Paragraph p1Title = section.addParagraph();
p1Title.appendText("\n\n2. Two-Lines-in-One + Different Brackets: ");

for (CombineBrackets bracket : CombineBrackets.values()) {
    Paragraph pTmp = section.addParagraph();
    TextRange rt = pTmp.appendText("Bracket Type " + bracket.name() + ": A B C D");
    rt.getCharacterFormat().setFontSize(12);
    rt.getCharacterFormat().setFontNameFarEast("Songti");
    FarEastLayout layoutTmp = new FarEastLayout();
    layoutTmp.setCombine(true);
    layoutTmp.setCombineBrackets(bracket);
    rt.getCharacterFormat().setFarEastLayout(layoutTmp);
}

doc.saveToFile(outputFile, FileFormat.Docx);
doc.close();
Bug Fix SPIREDOC-11155 Fixed the issue where a StringIndexOutOfBoundsException occurred when comparing documents.
Bug Fix SPIREDOC-11816 Fixed the issue where table formatting became disordered after accepting revisions.
Bug Fix SPIREDOC-11918 SPIREDOC-11926 SPIREDOC-11960 SPIREDOC-11964 SPIREDOC-11968 Fixed the issue where content layout was inconsistent when converting Word to PDF.
Bug Fix SPIREDOC-11919 Fixed the issue where the display effect was incorrect when opening merged Word documents in WPS.
Bug Fix SPIREDOC-11956 Fixed the issue where table layout was incorrect when converting Word to HTML.
Bug Fix SPIREDOC-11962 Fixed the issue where images rendered incorrectly when converting Word to PDF in Ubuntu environments.
Bug Fix SPIREDOC-11966 Fixed the issue where font effects were incorrect when converting Word to PDF.
Bug Fix SPIREDOC-11973 Fixed the issue where packaging errors occurred in higher-version Java environments.
Bug Fix SPIREDOC-11975 Added compatibility for "Double-line Combination" effect when converting Word to PDF.
Click the link below to download Spire.Doc for Java 14.7.0: