poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 57342] New: Excel is getting corrupt : Apache poi version poi-3.9
Date Thu, 11 Dec 2014 19:55:11 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=57342

            Bug ID: 57342
           Summary: Excel is getting corrupt : Apache poi version poi-3.9
           Product: POI
           Version: 3.9-FINAL
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSSF
          Assignee: dev@poi.apache.org
          Reporter: pal.ratikanta@gmail.com

Created attachment 32284
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=32284&action=edit
Attached! source

Hi,
After 7 lakh records file are getting corroupted,when i am writing 1 million
recors with 60 columns its working fine but when i am writing 7.5 lakh records
with 100 columns file are getting corrupted.

I have attached snipnet of code . Kindly suggest i if doing something wrong

package com.rati.Dec;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;

import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.streaming.SXSSFSheet;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;

public class MillionTest1 {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        SXSSFWorkbook workbook = new SXSSFWorkbook(100);
        workbook.setCompressTempFiles(true);
        SXSSFSheet sheet = null;
        Row row = null;
        Cell cell = null;
        sheet = (SXSSFSheet) workbook.createSheet("Test");
        FileOutputStream fileOut = null;
        try {
            System.out.println("Started!");
            for (int i = 0; i < 777384; i++) {
                row = sheet.createRow(i);
                for (int j = 0; j < 100; j++) {
                    cell = row.createCell(j);
                    cell.setCellValue("Rati : row : "+i +" Col: "+ j);
                }
            }

            fileOut = new FileOutputStream(
                    new File("Z:\\output\\Version\\Version11.xlsx"));
            workbook.write(fileOut);

        } catch (Exception exception) {
            exception.printStackTrace();
        } finally {
            workbook.dispose();
            try {
                fileOut.flush();
                fileOut.close();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            System.out.println("Completed!");
        }
    }

}

-- 
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