poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yegor Kozlov <yegor.koz...@dinom.ru>
Subject Re: problem opening excel 2007 created using SXSSF with sheets having child rows
Date Wed, 12 Oct 2011 07:29:54 GMT
Shreya,

Can you post an isolated code (ideally a junit test or a simple Java
main app) that generates the problematic output? The code should use
only JDK and POI, not third-party libraries and any of poiSsUtil, etc.

I suspect the problem is in createFreezePane, but can't tell for sure
without a full test code.

Yegor

On Tue, Oct 11, 2011 at 7:45 PM, Shreyaswini <shreya.enc@gmail.com> wrote:
> Hi All,
>
> I have been facing issues when i generate .xlsx file using SXSSF for the
> sheets which have child rows in them. I don't get the data populated in the
> particular sheet. I also get the message "excel found unreadable content in
> .xlsx. Do you want to recover the contents of this workbook?".
>
> My POI version is 3.8-beta4.
>
> I have written the sample code below. Also, i have attached the excel which
> has caused the issue.
>
> It works fine for the sheets generated with normal rows.
>
>    protected void buildExcelDocument(Map&lt;String, Object&gt; model,
> SXSSFWorkbook workbook, HttpServletRequest request,
>        HttpServletResponse response) throws Exception {
>
>        if (model == null || workbook == null || model.isEmpty()) {
>            return;
>        }
>        String performanceType = (String)
> model.get(PerfExcelModelConstants.PERF_TYPE);
>        Date effectiveDate = (Date)
> model.get(PerfExcelModelConstants.EFF_DATE);
>        String entityName = (String)
> model.get(PerfExcelModelConstants.ENTITY_NAME);
>
>        String excelSheetName =
> CommonUtil.getExcelNameForXssf(performanceType, entityName, effectiveDate);
>
>        response.reset();
>        response.setContentType("application/x-download");
>        response.setHeader("Content-Disposition", excelSheetName);
>
>           createSampleSheet(model, workbook);
> }
>
>    private void createSampleSheet(Map&lt;String, Object&gt; model,
> SXSSFWorkbook workbook) {
>        Sheet sampleSheet = workbook.createSheet("sampleSheet");
>
>        // Set the sheet outline style
>        sampleSheet.setRowSumsBelow(false);
>
>        // Add the as of date
>        poiSsUtil.addAsOfDate(sampleSheet, (Date)
> model.get(PerfExcelModelConstants.AS_OF_DATE), 0);
>
>        // Get the column inclusion mode
>        ColumnInclusionMode columnInclusionMode = (ColumnInclusionMode)
> model
>            .get(PerfExcelModelConstants.EXCLUSION);
>
>        Map&lt;String, String&gt; columnLabelMapSAmple = new
> HashMap&lt;String, String&gt;(COLUMN_LABEL_MAP); // override
>              poiSsUtil.addObjListToSheet((List)
> model.get(PerfExcelModelConstants.SAMPLE_PERF_LIST), sampleSheet, 1,
>            (List<String>)
> model.get(PerfExcelModelConstants.SAMPLE_COL_LIST), columnInclusionMode,
>            columnLabelMapSample, true);
>
>        // Add freeze pane
>        sampleSheet.createFreezePane(1, 3);
>
>        // Auto fit all the columns
>        poiSsUtil.autoFitAllColumns(sampleSheet);
>    }
> http://apache-poi.1045710.n5.nabble.com/file/n4892194/Sample.xlsx
> Sample.xlsx
> http://apache-poi.1045710.n5.nabble.com/file/n4892194/Sample.xlsx
> Sample.xlsx
>
> Can somebody please help me out with this issue?
>
> Thanks,
> Shreya
>
> --
> View this message in context: http://apache-poi.1045710.n5.nabble.com/problem-opening-excel-2007-created-using-SXSSF-with-sheets-having-child-rows-tp4892194p4892194.html
> Sent from the POI - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>
>

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


Mime
View raw message