ASF Bugzilla – Attachment 36766 Details for
Bug 63152
Too many identical CellStyles cause .xls to be incorrectly rendered in Office 365
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
Another test case with style changes and SXSSF
test_xlsbug.txt (text/plain), 1.75 KB, created by
blackbear.coleman
on 2019-09-06 15:10:01 UTC
(
hide
)
Description:
Another test case with style changes and SXSSF
Filename:
MIME Type:
Creator:
blackbear.coleman
Created:
2019-09-06 15:10:01 UTC
Size:
1.75 KB
patch
obsolete
>import org.apache.poi.hssf.usermodel.HSSFOptimiser; >import org.apache.poi.hssf.usermodel.HSSFWorkbook; >import org.apache.poi.ss.usermodel.*; >import org.apache.poi.xssf.streaming.SXSSFWorkbook; > >import java.io.FileOutputStream; >import java.io.IOException; >import java.io.OutputStream; > >public final class TestXLSBUG { > public static void main(String[] args) throws Exception { > System.setProperty("org.apache.poi.util.POILogger", "org.apache.poi.util.SystemOutLogger"); > create(new HSSFWorkbook(), "xls", false); // the problem shows up in this one; notice cell (2, M) and beyond >// create(new HSSFWorkbook(), "xls", true); // the optimize corrects the issue >// create(new SXSSFWorkbook(), "xlsx", false); // there is no problem with this one > } > > private static void create(Workbook workbook, String extension, boolean optimize) throws IOException { > Sheet sheet = workbook.createSheet(); > > for (int i = 0; i < 10; i++) { > Row row = sheet.createRow(i); > for (int j = 0; j < 200; j++) { > Cell cell = row.createCell(j); > cell.setCellValue(String.format("%d, %d", i, j)); > CellStyle style = workbook.createCellStyle(); > style.setRotation((short) (j - 90)); // used to make each style somewhat unique and obvious; aka, highlighting bug in sheet > cell.setCellStyle(style); > } > } > > if (optimize && workbook instanceof HSSFWorkbook) { > HSSFOptimiser.optimiseCellStyles((HSSFWorkbook) workbook); // this fixes it > } > > try (OutputStream output = new FileOutputStream("workbook." + extension)) { > workbook.write(output); > } > } >}
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 63152
:
36429
| 36766