poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 60094] New: Excel file unreadable due to XSSFPivotTable.addReportFilter
Date Wed, 07 Sep 2016 20:06:29 GMT
https://bz.apache.org/bugzilla/show_bug.cgi?id=60094

            Bug ID: 60094
           Summary: Excel file unreadable due to
                    XSSFPivotTable.addReportFilter
           Product: POI
           Version: 3.15-dev
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
          Assignee: dev@poi.apache.org
          Reporter: datasurfer@gmail.com

package gabrieljones.poi;

import org.apache.poi.ss.usermodel.DataConsolidateFunction;
import org.apache.poi.ss.util.AreaReference;
import org.apache.poi.ss.util.CellReference;
import org.apache.poi.xssf.usermodel.XSSFPivotTable;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

import java.io.FileOutputStream;

public class Main {

    public static void main(String[] args) throws Exception {
        XSSFWorkbook wb = new XSSFWorkbook();
        XSSFSheet sheet = (XSSFSheet) wb.createSheet();

        XSSFRow row1 = sheet.createRow(0);
        row1.createCell(0).setCellValue("Names");
        row1.createCell(1).setCellValue("#");
        row1.createCell(2).setCellValue("Data");
        row1.createCell(3).setCellValue("Value");
        XSSFRow row2 = sheet.createRow(1);
        row2.createCell(0).setCellValue("Jan");
        row2.createCell(1).setCellValue(10);
        row2.createCell(2).setCellValue("Apa");
        row2.createCell(3).setCellValue(11.11);
        XSSFRow row3 = sheet.createRow(2);
        row3.createCell(0).setCellValue("Ben");
        row3.createCell(1).setCellValue(9);
        row3.createCell(2).setCellValue("Bepa");
        row3.createCell(3).setCellValue(12.12);

        XSSFPivotTable pivotTable = sheet.createPivotTable(new
AreaReference("A1:D3"), new CellReference(0,5));

        pivotTable.addRowLabel(2);
        pivotTable.addColumnLabel(DataConsolidateFunction.COUNT, 1);
        pivotTable.addReportFilter(0); //This line renders the resulting xlsx
file unreadable

        wb.write(new FileOutputStream("reportFilter.xlsx"));
    }
}

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


Mime
View raw message