]> source.dussan.org Git - poi.git/commitdiff
make CreatePivotTable self-explaining with better variable names
authorJaven O'Neal <onealj@apache.org>
Wed, 24 Aug 2016 04:03:26 +0000 (04:03 +0000)
committerJaven O'Neal <onealj@apache.org>
Wed, 24 Aug 2016 04:03:26 +0000 (04:03 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1757459 13f79535-47bb-0310-9956-ffa450edef68

src/examples/src/org/apache/poi/xssf/usermodel/examples/CreatePivotTable.java

index 6549f482da3c202dcfa3b0f8e8106aeae9f511b6..a855feedae47d1922f57d9ad8ac173ad58339720 100644 (file)
@@ -40,8 +40,11 @@ public class CreatePivotTable {
         //Create some data to build the pivot table on
         setCellData(sheet);
 
-        AreaReference area = new AreaReference("A1:D4", SpreadsheetVersion.EXCEL2007);
-        XSSFPivotTable pivotTable = sheet.createPivotTable(area, new CellReference("H5"));
+        AreaReference source = new AreaReference("A1:D4", SpreadsheetVersion.EXCEL2007);
+        CellReference position = new CellReference("H5");
+        // Create a pivot table on this sheet, with H5 as the top-left cell..
+        // The pivot table's data source is on the same sheet in A1:D4
+        XSSFPivotTable pivotTable = sheet.createPivotTable(source, position);
         //Configure the pivot table
         //Use first column as row label
         pivotTable.addRowLabel(0);