private void checkPivotTable(XSSFPivotTable pivotTableBack) { Assert.IsNotNull(pivotTableBack.GetPivotCacheDefinition()); Assert.IsNotNull(pivotTableBack.GetPivotCacheDefinition().GetCTPivotCacheDefinition()); CT_CacheFields cacheFields = pivotTableBack.GetPivotCacheDefinition().GetCTPivotCacheDefinition().cacheFields; Assert.IsNotNull(cacheFields); Assert.AreEqual(8, cacheFields.SizeOfCacheFieldArray()); Assert.AreEqual("A", cacheFields.cacheField[0].name); }
private void checkPivotTables(XSSFWorkbook wb) { IList <XSSFPivotTable> pivotTables = (wb.GetSheetAt(0) as XSSFSheet).GetPivotTables(); Assert.IsNotNull(pivotTables); Assert.AreEqual(3, pivotTables.Count); XSSFPivotTable pivotTable = pivotTables[0]; checkPivotTable(pivotTable); }
public void SetUp() { IWorkbook wb = new XSSFWorkbook(); XSSFSheet sheet = (XSSFSheet)wb.CreateSheet(); IRow row1 = sheet.CreateRow(0); // Create a cell and Put a value in it. ICell cell = row1.CreateCell(0); cell.SetCellValue("Names"); ICell cell2 = row1.CreateCell(1); cell2.SetCellValue("#"); ICell cell7 = row1.CreateCell(2); cell7.SetCellValue("Data"); ICell cell10 = row1.CreateCell(3); cell10.SetCellValue("Value"); IRow row2 = sheet.CreateRow(1); ICell cell3 = row2.CreateCell(0); cell3.SetCellValue("Jan"); ICell cell4 = row2.CreateCell(1); cell4.SetCellValue(10); ICell cell8 = row2.CreateCell(2); cell8.SetCellValue("Apa"); ICell cell11 = row1.CreateCell(3); cell11.SetCellValue(11.11); IRow row3 = sheet.CreateRow(2); ICell cell5 = row3.CreateCell(0); cell5.SetCellValue("Ben"); ICell cell6 = row3.CreateCell(1); cell6.SetCellValue(9); ICell cell9 = row3.CreateCell(2); cell9.SetCellValue("Bepa"); ICell cell12 = row1.CreateCell(3); cell12.SetCellValue(12.12); AreaReference source = new AreaReference("A1:C2"); pivotTable = sheet.CreatePivotTable(source, new CellReference("H5")); }