main
黄海 9 months ago
parent d9bcc678bb
commit e93de481e2

@ -1,36 +0,0 @@
package com.dsideal.base.Tools.FillData.Test;
import com.aspose.words.*;
public class AsposeWord {
public static void main(String[] args) throws Exception {
// 加载 Word 文档
Document doc = new Document("c:/昭通市.docx");
// 遍历文档中的所有内嵌形状
for (Shape shape : (Iterable<Shape>) doc.getChildNodes(NodeType.SHAPE, true)) {
if (shape.getChart() != null) {
// 获取图表对象
Chart chart = shape.getChart();
// 获取图表的标题
String chartTitle = chart.getTitle().getText();
// 遍历图表中的所有系列
for (ChartSeries series : chart.getSeries()) {
// 获取系列中的所有数据点
for (int i = 0; i < series.getDataPoints().getCount(); i++) {
System.out.println(series.getDataPoints().get(0).getMarker());
// 获取数据点的值
//double value = series.getDataPoints().get(i).getValue();
System.out.println("Data Point Value: "+ series.getDataPoints().get(0).getValue());
// 打印数据点的值
//System.out.println("Data Point Value: " + value);
}
}
}
}
}
}

@ -36,7 +36,7 @@ public class C9_Test {
//排序后的图表
List<XWPFChart> charts = ExcelKit.getSortListForXWPFChart(doc.getCharts());
XSSFWorkbook workbook = charts.get(1).getWorkbook();
XSSFWorkbook workbook = charts.get(3).getWorkbook();
List<List<String>> source1 = ExcelKit.readSheet(workbook, 1);
System.out.println(source1);
}

Loading…
Cancel
Save