I tried the following code using aspose-cells-23.1.jar. Code executed without any error. However excel is not able to load waterfall chart properly.
Error:- Removed Part: /xl/drawings/drawing1.xml part. (Drawing shape)
package aspose;
import com.aspose.cells.*;
public class WaterfallChart {
public static void main(String[] args) throws Exception {
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.getWorksheets().get(0);
System.out.println(workbook.getClass().getProtectionDomain().getCodeSource());
Cells cells = worksheet.getCells();
// Insert data
cells.get("A1").putValue("Categories");
cells.get("A2").putValue("Start");
cells.get("A3").putValue("Positive Value 1");
cells.get("A4").putValue("Negative Value 1");
cells.get("A5").putValue("Positive Value 2");
cells.get("A6").putValue("End");
cells.get("B1").putValue("Values");
cells.get("B2").putValue(0);
cells.get("B3").putValue(20);
cells.get("B4").putValue(-10);
cells.get("B5").putValue(15);
cells.get("B6").putValue(25);
int chartIndex = worksheet.getCharts().add(ChartType.WATERFALL, 5, 0, 15, 5);
Chart waterfallChart = worksheet.getCharts().get(chartIndex);
waterfallChart.getNSeries().add("B2:B6", true);
waterfallChart.getNSeries().setCategoryData("A2:A6");
workbook.save("WaterfallChart.xlsx");
}
}