コード例 #1
0
 public void GetSinglePivotTableFromSingleCellReference()
 {
     using (var package = new ExcelPackage(new FileInfo("PivotTableColumnFields.xlsx")))
     {
         var provider = new EpplusExcelDataProvider(package);
         var pt       = provider.GetPivotTable(new ExcelAddress("NoSubtotals!A1"));
         Assert.AreEqual("NoSubtotalsPivotTable1", pt.Name);
         pt = provider.GetPivotTable(new ExcelAddress("NoSubtotals!D8"));
         Assert.AreEqual("NoSubtotalsPivotTable1", pt.Name);
         pt = provider.GetPivotTable(new ExcelAddress("NoSubtotals!I13"));
         Assert.AreEqual("NoSubtotalsPivotTable1", pt.Name);
     }
 }
コード例 #2
0
 public void GetSinglePivotTableFromReferenceNoPivotTable()
 {
     using (var package = new ExcelPackage(new FileInfo("PivotTableColumnFields.xlsx")))
     {
         var provider = new EpplusExcelDataProvider(package);
         Assert.IsNull(provider.GetPivotTable(new ExcelAddress("Sheet1!ZZ999")));
     }
 }
コード例 #3
0
 public void GetSinglePivotTableFromRangeWithMultiplePivotTables()
 {
     using (var package = new ExcelPackage(new FileInfo("PivotTableColumnFields.xlsx")))
     {
         var provider = new EpplusExcelDataProvider(package);
         // RowItems!B3:M7 contains three pivot tables. The first one (closest to A1) should be returned.
         var pt = provider.GetPivotTable(new ExcelAddress("RowItems!B3:M7"));
         Assert.AreEqual("RowItemsPivotTable1", pt.Name);
     }
 }