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: [email protected]
Reporter: [email protected]
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: [email protected]
For additional commands, e-mail: [email protected]