Spire.Doc for Java 5.2.3 supports finding all matched strings in a paragraph

2022-02-21 06:40:29

We are pleased to announce the release of Spire.Doc for Java 5.2.3. This version supports finding all matched strings in a paragraph. It also enhances the conversion from Word to PDF and HTML to Word. In addition, it fixes some known issues such as the application threw "Operation is not valid due to the current state of the object" when loading a Word file. More details are listed below.

Here is a list of changes made in this release

Category ID Description
New feature SPIREDOC-3990 Supports finding all matched strings in a paragraph.
Document document = new Document();
document.loadFromFile("Sample.docx");
Section s = document.getSections().get(0);
Paragraph para = s.getParagraphs().get(0);
//the first method
TextSelection[] textSelections = para.findAllString("The", false, true);
for (TextSelection selection : textSelections)
{
    //highlight
    selection.getAsOneRange().getCharacterFormat().setHighlightColor(new Color(255, 255, 0));
}
//the second method
Pattern c = Pattern.compile("The");
TextSelection[] textSelections = para.findAllPattern(c);
for (TextSelection selection : textSelections)
{
    TextRange[] results = selection.getAsRange();
    for (TextRange result : results)
    {
        //highlight
        result.getCharacterFormat().setHighlightColor(Color.yellow);
    }
}
Bug SPIREDOC-7038 Fixes the issue that the application threw "Operation is not valid due to the current state of the object" when loading a Word file.
Bug SPIREDOC-7182 Fixes the issue that the finding result was incorrect.
Bug SPIREDOC-7200
SPIREDOC-7202
SPIREDOC-7239
Fixes the issue that the content format was incorrect after converting Word file to PDF.
Bug SPIREDOC-7214 Fixes the issue that the table content format was incorrect after accepting changes.
Bug SPIREDOC-7224 Fixes the issue that some page lost after converting Word file to PDF.
Bug SPIREDOC-7236 Fixes the issue that the application threw "OutOfMemoryError" when converting Word file to PDF.
Bug SPIREDOC-7240 Fixes the issue that some text was overlapped after converting Word file to PDF.
Bug SPIREDOC-7242 Fixes the issue that the application threw "IndexOutOfBoundsException" when converting a HTML file to Word.
Bug SPIREDOC-7254 Fixes the issue that the list content was incorrect after converting Word file to PDF.
Bug SPIREDOC-7269 Fixes the issue that the table content format was incorrect after accepting changes.
Bug SPIREDOC-7272 Fixes the issue that the PDF file could not generate when converting Word file to PDF.
Bug SPIREDOC-7310 Fixes the issue that the table content lost after converting Word file to PDF.
Bug SPIREDOC-7316 Fixes the issue that the application threw "NullPointerException" when loading a Word file.
Bug SPIREDOC-7374 Fixes the issue that the application threw "Namespace URI must not be null when prefix is not an empty string" when saving a Word file.
Click the link to download Spire.Doc for Java 5.2.3: