Aspose word for Java 如何shape获取chart图表类型,如是饼图还是折线图

aspose word for Java 如何shape获取chart图表类型,如是饼图还是折线图

@SalesDhorde 图表可以有不同类型的系列(复合图表),因此正确的方法是获取每个系列类型。请参阅以下代码:

Document doc = new Document("input.docx");
Shape chartShape = (Shape)doc.getChild(NodeType.SHAPE, 0, true);
Chart chart = chartShape.getChart();
for (ChartSeries s : chart.getSeries())
    System.out.println(ChartSeriesType.getName(s.getSeriesType()));