Esempio n. 1
0
        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);
        }