Spire.Office for Java 11.4.0 is released

Spire.Office for Java 11.4.0 is released

2026-04-30 09:21:13

We're pleased to announce the release of Spire.Office for Java 11.4.0. In this version, the Spire.Doc for Java supports saving charts as templates and retrieving data values from charts. Spire.PDF for Java optimizes memory consumption when merging PDFs. In addition, many known issues that occurred during the conversion and processing of Word/Excel/PDF/PowerPoint files have been successfully fixed. More details are listed below.

Click the link to download Spire.Office for Java 11.4.0:

Here is a list of changes made in this release

Spire.Doc for Java

Category ID Description
New Feature SPIREDOC-10293 Supports saving charts as templates.
Document doc = new Document();
        doc.loadFromFile(inputFile);
        int count = 1;
        for (Section sec : (Iterable) doc.getSections()) {
            for (Paragraph paragraph : (Iterable) sec.getParagraphs()) {
                for (int i = 0; i < paragraph.getChildObjects().getCount(); i++) {
                    DocumentObject obj = paragraph.getChildObjects().get(i);
                    if (obj instanceof ShapeObject) {
                        ShapeObject shape = (ShapeObject) obj;
                        Chart chart = shape.getChart();
                        String fileName = outputFile + count + ".crtx";
                        chart.saveAsTemplate(fileName);
                        count++;
                    }
                }
            }
        }
New Feature SPIREDOC-10828 Adds the XValues property to retrieve data XValues on the chart's X-axis, and the YValues property to retrieve data values on the Y-axis for a specified series.
Document doc = new Document();
doc.loadFromFile(inputFile);
StringBuilder sb = new StringBuilder();
int pageNumber = 1;
for (Section sec : (Iterable) doc.getSections()) {
    for (Paragraph paragraph : (Iterable) sec.getParagraphs()) {
        for (int i = 0; i < paragraph.getChildObjects().getCount(); i++) {
            DocumentObject obj = paragraph.getChildObjects().get(i);
            if (obj instanceof ShapeObject) {
                ShapeObject shape = (ShapeObject) obj;
                Chart chart = shape.getChart();
                sb.append("\r\n\r\nPage " + pageNumber + ":\r\n" + "All X-axis data: ");
                for(int x = 0; x < chart.getXValues().getCount(); x++){
                    // Print all X-axis data values
                    ChartValue xVal = chart.getXValues().get(x);
                    sb.append(xVal.getStringValue() + " ");
                }
                ChartSeries series = chart.getSeries().get(0);
                sb.append("\r\nY-axis data: ");
                // Print all Y-axis data values of the first series
                for(ChartValue yVal : (Iterable<ChartValue>)series.getYValues()){
                    sb.append(yVal.getValue() + " ");
                }
            }
        }
    }
    pageNumber++;
}
New Feature SPIREDOC-11457 Supports getting and setting the position of chart data labels.
Document doc = new Document();
for (ChartDataLabelPosition position : ChartDataLabelPosition.values()) {
    Section section = doc.addSection();
    section.addParagraph().appendText(position.name());
    Paragraph newPara = section.addParagraph();
    ShapeObject shape = newPara.appendChart(ChartType.Pie, 500, 300);
    Chart chart = shape.getChart();
    chart.getSeries().get(0).hasDataLabels(true);
    chart.getSeries().get(0).getDataLabels().setShowCategoryName(true);
    chart.getSeries().get(0).getDataLabels().setShowValue(true);
    chart.getSeries().get(0).getDataLabels().setPosition(position);
    ShapeObject shape2 = newPara.appendChart(ChartType.Bubble, 500, 300);
    Chart chart2 = shape2.getChart();
    chart2.getSeries().get(0).hasDataLabels(true);
    chart2.getSeries().get(0).getDataLabels().setShowCategoryName(true);
    chart2.getSeries().get(0).getDataLabels().setShowValue(true);
    chart2.getSeries().get(0).getDataLabels().setPosition(position);
}
doc.saveToFile(outputFile, FileFormat.Docx);
Bug Fix SPIREDOC-11879 Fixed the issue where a "NoClassDefFoundError" exception was thrown when adding HTML via appendHTML.
Bug Fix SPIREDOC-11796 Fixes the issue where some image sizes were not automatically scaled when converting HTML to Word.
Bug Fix SPIREDOC-11885 Fixes the "NullPointerException" exception that occurred when converting Word to PDF.
Bug Fix SPIREDOC-11770 Fixes the "There are too many styles in the document" exception that occurred when converting Word to PDF.
Bug Fix SPIREDOC-11826 Fixes the issue where tables and images were lost when converting Markdown to Word.
Bug Fix SPIREDOC-11836 Fixes the issue where field updating failed when converting Word to PDF.
Bug Fix SPIREDOC-11868 Fixes the "NullPointerException" exception that occurred when populating control content.
Bug Fix SPIREDOC-11876 Fixes the "NullPointerException" exception that occurred when reading document data in a multi-threaded environment.

Spire.XLS for Java

Category ID Description
Bug Fix SPIREXLS-6123 Fixed the issue where extra pages were generated when converting Excel to PDF.

Spire.PDF for Java

Category ID Description
Optimization SPIREPDF-7657 Optimized memory consumption when merging PDF documents.
Bug Fix SPIREPDF-7843 Fixed an issue where replacing text incorrectly caused other text to be lost.
Bug Fix SPIREPDF-8008 Fixed an issue where content became misaligned after text replacement.
Bug Fix SPIREPDF-8019 Fixed an issue where converting PDF to OFD without a license threw a "Specified argument was out of the range of valid values." exception.

Spire.Presentation for Java

Category ID Description
Bug Fix SPIREPPT-3095 Fixed the issue where OLE object data was lost after adding OLE object to PowerPoint documents.

Spire.OCR for Java

Category ID Description
Bug Fix SPIREOCR-120 Fixed an issue where license recognition failed when the provided license path started with a "\" character.