poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Stillwell <chris.stillw...@farecompare.com>
Subject Re: Creating pivot table and summation column
Date Thu, 11 Aug 2016 16:32:31 GMT
Thanks, that very much looks like it could be the problem.  I didn't see
that there is a target release for the fix.  I tried 3.15-beta2 which looks
like the most current build and did not see the fix in there.  Any

Thanks again,


On Thu, Aug 11, 2016 at 10:45 AM, Javen O'Neal <javenoneal@gmail.com> wrote:

> Read these two bugs to make sure that isn't the problem first. I have not
> verified either bug yet.
> https://bz.apache.org/bugzilla/show_bug.cgi?id=59705
> https://bz.apache.org/bugzilla/show_bug.cgi?id=59368
> On Aug 11, 2016 8:30 AM, "Chris Stillwell" <chris.stillwell@farecompare.c
> om> wrote:
>> I have a sheet with 4 columns of data that I am wanting to create 2 pivot
>> tables with.
>> The first column has a classification label.
>> The second column has a start of week date.
>> The third and fourth columns contain integer values.
>> I want each pivot table to have a row for each classification and then a
>> column for each week start date, under which is the sum of one of the
>> integer columns.
>> So far I can only get it to work when I add the date column as a filter
>> like the code snippet below:
>> XSSFSheet pivotSheet = (XSSFSheet) wb.createSheet("Pivot");
>> XSSFPivotTable pivotTable1 = pivotSheet.createPivotTable(
>>         new AreaReference(sheet.getSheetName()+"!A1:"+cellName,
>> SpreadsheetVersion.EXCEL2007),
>>         new CellReference("A4"));
>> pivotTable1.addRowLabel(0);     // classification
>> pivotTable1.addReportFilter(1); // weekStartDate
>> pivotTable1.addColumnLabel(DataConsolidateFunction.SUM,2,"uniquepages");
>> When I open the workbook in Excel and open the Pivot Table Builder I
>> can drag the weekStartDate from the Filters box to the Columns box and
>> that gives me the result I want, but I have not been able to do it
>> using poi.
>> I tried replacing the addReportFilter with pivotTable1.addDataColumn(1,
>> false);
>> That just removed the filter and only displayed a column for the
>> classification rows and one summation column.
>> When I try pivotTable1.addDataColumn(1, true);
>> The worksheet will not open in Excel. I get an error dialog that says,
>> "Excel could not open seo_traffic_pivot.xlsx because some content is
>> unreadable. Do you want to open and repair this workbook?"
>> It seems like there should be a simple solution, but I have not been
>> able to figure it out.  If anybody can point me in the right direction
>> I would appreciate it.
>> Chris

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message