Spire.Doc for Java

ニュース&リリース

2026-04-30

Spire.Doc for Java 14.4.9 はグラフをテンプレートとして保存する機能をサポートしました

Spire.Doc for Java 14.4.9 をリリースいたしました。このバージョンでは、グラフをテンプレートとして保存する機能がサポートされ、グラフの X 軸データ値を取得する XValues プロパティ、および指定された系列の Y 軸データ値を取得する YValues プロパティが追加されました。また、グラフのデータラベルの位置の取得と設定も可能になりました。さらに、Word から PDF、HTML から Word、Markdown から Word への変換時に発生したいくつかの不具合も修正されました。詳細は以下の通りです。

変更内容一覧
カテゴリー ID 説明
新機能 SPIREDOC-10293 グラフをテンプレートとして保存する機能をサポートしました。
 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++;
                    }
                }
            }
        }
新機能 SPIREDOC-10828 グラフの X 軸のデータ値を取得する XValues プロパティ、および指定した系列の Y 軸のデータ値を取得する YValues プロパティを追加しました。
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++;
}
新機能 SPIREDOC-11457 グラフのデータラベルの位置の取得および設定をサポートしました。
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);
不具合修正 SPIREDOC-11796 HTML から Word への変換時に、一部の画像サイズが自動的にスケーリングされない不具合を修正しました。
不具合修正 SPIREDOC-11885 Word から PDF への変換時に “NullPointerException” 例外が発生する不具合を修正しました。
不具合修正 SPIREDOC-11770 Word から PDF への変換時に “There are too many styles in the document” 例外が発生する不具合を修正しました。
不具合修正 SPIREDOC-11826 Markdown から Word への変換時に、テーブルと画像が失われる不具合を修正しました。
不具合修正 SPIREDOC-11836 Word から PDF への変換時にフィールドの更新に失敗する不具合を修正しました。
不具合修正 SPIREDOC-11868 コントロールの内容を入力する際に “NullPointerException” 例外が発生する不具合を修正しました。
不具合修正 SPIREDOC-11876 マルチスレッド環境で文書データを読み取る際に “NullPointerException” 例外が発生する不具合を修正しました。
以下のリンクをクリックして、Spire.Doc for Java 14.4.9 をダウンロードしてください: