Spire.Doc for Java 14.11.3 supports setting Word chart series styles

2026-11-24 08:51:13

We're pleased to announce the release of Spire.Doc for Java 14.11.3. This version supports setting chart series styles and also fixes several issues encountered when converting Word to PDF as well as ODT to PDF. More details are listed below.

Here is a list of all changes made in this release

Category ID Description
New Feature SPIREDOC-11882 Added support for setting chart series styles, including line color, width, line style and fill effects.
Document document = new Document();
document.loadFromFile(inputFile);
Section section = document.getSections().get(0);
for (Paragraph paragraph : (Iterable<? extends Paragraph>) section.getParagraphs()) {
    for (int i = 0; i < paragraph.getChildObjects().getCount(); i++) {
        if (paragraph.getChildObjects().get(i) instanceof ShapeObject) {
            Chart chart = ((ShapeObject) paragraph.getChildObjects().get(i)).getChart();

            // 1. Line format: color, width, line style, dash style
            Stroke stroke = chart.getSeries().get(0).getDataPoints().getFormat().getStroke();
            stroke.getFill().setColor(Color.RED);
            stroke.setWeight(2);
            stroke.setLineStyle(ShapeLineStyle.Single);
            stroke.setDashStyle(DashStyle.Solid);

            // 2. Solid fill: fill type, color, transparency
            Fill fill = chart.getSeries().get(0).getDataPoints().getFormat().getFill();
            fill.setFillType(FillType.Solid);
            fill.setColor(Color.BLUE);
            fill.setTransparency(0.3);

            // 3. Gradient fill: gradient type, direction, angle, gradient stops
            Fill gradientFill = chart.getFormat().getFill();
            gradientFill.setFillType(FillType.Shade);
            gradientFill.setGradientType(GradientFillType.Linear);
            gradientFill.setGradientDirection(GradientFillDirection.Linear_Down);
            gradientFill.setGradientAngle(90);
            gradientFill.getGradientStops().add(new GradientStop(0, Color.WHITE, 1));
            gradientFill.getGradientStops().add(new GradientStop(1, Color.BLUE, 0.5));

            // 4. Pattern fill: pattern type, foreground color, background color
            Fill patternFill = chart.getLegend().getFormat().getFill();
            patternFill.setFillType(FillType.Pattern);
            patternFill.setPattern(PatternType.Percent_10);
            patternFill.setForegroundColor(Color.RED);
            patternFill.setBackgroundColor(Color.WHITE);

            // 5. Picture/texture fill: image source, transparency, stretch or tile
            Fill imageFill = chart.getAxisX().getFormat().getFill();
            imageFill.setFillType(FillType.Picture);
            imageFill.setImage(imagePath);
            imageFill.setImageTransparency(0.5);
            imageFill.stretchImage(0, 0, 100, 100);
        }
    }
}
document.saveToFile(outputFile, FileFormat.Docx);
document.close();
Bug Fix SPIREDOC-11615 Fixed the issue where the table of contents was updated incorrectly.
Bug Fix SPIREDOC-12111 Fixed the issue where footnote and body superscript numbers were positioned too low when converting Word to PDF.
Bug Fix SPIREDOC-12124
SPIREDOC-12125
Fixed the issue where converting Word to PDF threw "java.lang.StackOverflowError" exception.
Bug Fix SPIREDOC-12136 Fixed the issue where converting ODT to PDF threw "java.lang.NullPointerException" exception.
Click the link below to download Spire.Doc for Java 14.11.3: