public void TestAddChartsToNewWorkbook() { XSSFWorkbook wb = new XSSFWorkbook(); XSSFSheet s1 = (XSSFSheet)wb.CreateSheet(); XSSFDrawing d1 = (XSSFDrawing)s1.CreateDrawingPatriarch(); XSSFClientAnchor a1 = new XSSFClientAnchor(0, 0, 0, 0, 1, 1, 10, 30); XSSFChart c1 = (XSSFChart)d1.CreateChart(a1); Assert.AreEqual(1, d1.GetCharts().Count); Assert.IsNotNull(c1.GetGraphicFrame()); Assert.IsNotNull(c1.GetOrCreateLegend()); XSSFClientAnchor a2 = new XSSFClientAnchor(0, 0, 0, 0, 1, 11, 10, 60); XSSFChart c2 = (XSSFChart)d1.CreateChart(a2); Assert.AreEqual(2, d1.GetCharts().Count); }
public void TestGetChartAxisBug57362() { //Load existing excel with some chart on it having primary and secondary axis. IWorkbook workbook = XSSFTestDataSamples.OpenSampleWorkbook("57362.xlsx"); ISheet sh = workbook.GetSheetAt(0); XSSFSheet xsh = (XSSFSheet)sh; XSSFDrawing Drawing = xsh.CreateDrawingPatriarch() as XSSFDrawing; XSSFChart chart = Drawing.GetCharts()[(0)]; List <IChartAxis> axisList = chart.GetAxis(); Assert.AreEqual(4, axisList.Count); Assert.IsNotNull(axisList[(0)]); Assert.IsNotNull(axisList[(1)]); Assert.IsNotNull(axisList[(2)]); Assert.IsNotNull(axisList[(3)]); }