Created attachment 32615 [details] Java code, excel template file, screenshots Method cloneStyleFrom(CellStyle cellStyle) does not copy all styles. For example: background color, borders. If trying to copy background color after calling this method, getting Exception: java.lang.IndexOutOfBoundsException: Index: 2, Size: 2 at java.util.ArrayList.RangeCheck(ArrayList.java:547) at java.util.ArrayList.get(ArrayList.java:322) at org.apache.poi.xssf.model.StylesTable.getFillAt(StylesTable.java:269) at org.apache.poi.xssf.usermodel.XSSFCellStyle.getCTFill(XSSFCellStyle.java:1081) at org.apache.poi.xssf.usermodel.XSSFCellStyle.setFillPattern(XSSFCellStyle.java:1133) at org.apache.poi.xssf.usermodel.XSSFCellStyle.setFillPattern(XSSFCellStyle.java:1154) at TestCopyFileExcel.copyCellStyle(TestCopyFileExcel.java:133) ... See attachment for details.
There have been a few fixes in that area lately which should make this work as expected. Please try a recent nightly build from https://builds.apache.org/job/POI/lastSuccessfulBuild/artifact/ and let us know if it works!
Created attachment 32616 [details] Java code
With latest build (poi-3.12-beta2-20150326): - Copying background colors for cells and rows, but doesn't - for columns; - When opening resulting excel file in MS-Excel getting same errors (see screenshots in the initial attachment); - Does not copy borders; - If trying to copy borders manually after calling this method (cloneStyleFrom) receive exception: java.lang.IndexOutOfBoundsException: Index: 10, Size: 2 at java.util.ArrayList.RangeCheck(ArrayList.java:547) at java.util.ArrayList.get(ArrayList.java:322) at org.apache.poi.xssf.model.StylesTable.getBorderAt(StylesTable.java:255) at org.apache.poi.xssf.usermodel.XSSFCellStyle.getCTBorder(XSSFCellStyle.java:1109) at org.apache.poi.xssf.usermodel.XSSFCellStyle.setBorderBottom(XSSFCellStyle.java:801) at org.apache.poi.xssf.usermodel.XSSFCellStyle.setBorderBottom(XSSFCellStyle.java:819) at TestCopyFileExcel.copyCellStyle(TestCopyFileExcel.java:134) ...
Do you know (any idea) when the next stable build (v. 3.12) could be released? Thanks.
I want to know if the last version has solved this problem,cause my program has met this problem,too. When I use the "clonecellstylefrom()" function,the color of the font/background leave white. Do you really change it in v3.12? Looking forward to your reply. from a china user
In the version 3.12