ASF Bugzilla – Attachment 36258 Details for
Bug 62872
Writing large files with 800k rows gives java.io.IOException: This archive contains unclosed entries.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
modified test
SXSSFTest.java (text/x-java), 1.79 KB, created by
Andreas Beeker
on 2018-11-11 20:33:59 UTC
(
hide
)
Description:
modified test
Filename:
MIME Type:
Creator:
Andreas Beeker
Created:
2018-11-11 20:33:59 UTC
Size:
1.79 KB
patch
obsolete
>package poijartest; > >import org.apache.poi.ss.usermodel.BuiltinFormats; >import org.apache.poi.ss.usermodel.CellStyle; >import org.apache.poi.ss.usermodel.CreationHelper; >import org.apache.poi.xssf.streaming.SXSSFCell; >import org.apache.poi.xssf.streaming.SXSSFRow; >import org.apache.poi.xssf.streaming.SXSSFSheet; >import org.apache.poi.xssf.streaming.SXSSFWorkbook; > >import java.io.File; >import java.io.FileOutputStream; >import java.util.Date; > >public class SXSSFTest { > public static void main(String args[]) throws Exception { > final int COLUMN_COUNT = 300; > final int ROW_COUNT = 300000; > final int TEN_MINUTES = 1000*60*10; > > SXSSFWorkbook workbook = new SXSSFWorkbook(100); > workbook.setCompressTempFiles(true); > SXSSFSheet sheet = workbook.createSheet("RawData"); > > CellStyle dateStyle = workbook.createCellStyle(); > CreationHelper createHelper = workbook.getCreationHelper(); > dateStyle.setDataFormat(createHelper.createDataFormat().getFormat("m/d/yy h:mm")); > > SXSSFRow row = sheet.createRow(0); > for (int i = 0; i < COLUMN_COUNT; i++) { > row.createCell(i).setCellValue("Column " + (i+1)); > sheet.setDefaultColumnStyle(i, dateStyle); > sheet.setColumnWidth(i, 4000); > } > > for (int i = 1; i < ROW_COUNT; i++) { > row = sheet.createRow(i); > for (int j = 0; j < COLUMN_COUNT; j++) { > SXSSFCell cell = row.createCell(j); > cell.setCellValue(new Date((i-1)*TEN_MINUTES+(j*TEN_MINUTES)/COLUMN_COUNT)); > } > } > > try (FileOutputStream out = new FileOutputStream(new File("test62872.xlsx"))) { > workbook.write(out); > workbook.dispose(); > workbook.close(); > out.flush(); > } > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 62872
:
36225
|
36226
| 36258 |
36286
|
36287