ASF Bugzilla – Attachment 32796 Details for
Bug 58005
Amount of CellStyles is still limited to 32K
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
java code
TestPOI312Styles.java (text/x-java), 1.67 KB, created by
Michael
on 2015-06-05 13:24:01 UTC
(
hide
)
Description:
java code
Filename:
MIME Type:
Creator:
Michael
Created:
2015-06-05 13:24:01 UTC
Size:
1.67 KB
patch
obsolete
> >import java.io.FileOutputStream; >import java.text.SimpleDateFormat; >import java.util.Date; > >import org.apache.poi.ss.usermodel.CellStyle; >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 org.apache.poi.xssf.usermodel.XSSFFont; > >public class TestPOI312Styles >{ > > public static void main(String[] args) > { > SXSSFWorkbook spreadSheetDoc = new SXSSFWorkbook(5); > spreadSheetDoc.setCompressTempFiles(true); // temp files will be gzipped > SXSSFSheet sheet = (SXSSFSheet)spreadSheetDoc.createSheet(); > for(int i = 0; i < 11000; i++) // 11,000 rows > { > SXSSFRow row = (SXSSFRow)sheet.createRow(i); > for(int j = 0; j < 3; j++) // 3 cells in each row, so total just over 32767 cells > { > SXSSFCell cell = (SXSSFCell)row.createCell(j); > cell.setCellValue("cell " + i + "-" + j); > > CellStyle style = spreadSheetDoc.createCellStyle(); > XSSFFont font = (XSSFFont)spreadSheetDoc.createFont(); > switch (j) > { > case 0: > font.setBold(true); > break; > case 1: > font.setItalic(true); > break; > case 2: > font.setBold(true); > font.setItalic(true); > break; > } > > style.setFont(font); > cell.setCellStyle(style); > } > } > > try > { > sheet.flushRows(0); > FileOutputStream out = new FileOutputStream("TestPOI312Styles.xlsx"); > spreadSheetDoc.write(out); > out.close(); > > // dispose of temporary files backing this workbook on disk > spreadSheetDoc.dispose(); > spreadSheetDoc.close(); > } > catch(Exception e){ > e.printStackTrace(); > } > > System.out.println("Finished!"); > } > >}
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 58005
: 32796 |
32797