https://issues.apache.org/bugzilla/show_bug.cgi?id=47206


ROb <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |NEW




--- Comment #4 from ROb <[email protected]>  2009-05-18 08:24:22 PST 
---
Hi,

I am happy to give you additional information, as I have pinpointed why the
problem occurs. It is to do with the fact that I have applied a  XSSFCellStyle
to each cell before calling the autoSizeColumn.

I am creating a spreadsheet with multiple tabs (sheets). I am creating each
sheet as such:
----------
String[] columns = new String[]{"Column_1","Column_2", "Column_3"};
createSheet("Part Number Comparisons", columns);
----------

then....
--------------

 public void createSheet(String sheetName, String[] columns){
         XSSFCellStyle style = wb.createCellStyle();
        style.setFillForegroundColor(new XSSFColor(Color.lightGray));
        style.setFillPattern(XSSFCellStyle.SOLID_FOREGROUND);
        style.setAlignment(XSSFCellStyle.ALIGN_CENTER);
        style.setBorderBottom(XSSFCellStyle.BORDER_THIN);

         XSSFSheet sheet = wb.createSheet(sheetName);
         sheet.createFreezePane( 0, 1, 0, 1 );
         XSSFRow row = sheet.createRow((short) 0);

         for(int i=0;i<columns.length;i++){
             XSSFCell cell = row.createCell(i);
         cell.setCellValue(columns[i].toString());
         cell.setCellStyle(style);
         }

         XSSFRow row2 = sheet.createRow((short) 1);
         XSSFCellStyle style2 = wb.createCellStyle();
         style2.setFillForegroundColor(new XSSFColor(Color.WHITE));
         style2.setFillPattern(XSSFCellStyle.SOLID_FOREGROUND);
         style2.setAlignment(XSSFCellStyle.ALIGN_CENTER);
    }

-------------


FINALLY, the resizeXLSXColumns(String FILENAME) method is called AFTER the
above has taken place.

Simply, the autoSizeColumns() for XSSFSheet does not deal with XSSFCellSytle
very well, where as HSSFSheet seems to handle HSSFCellStyle Ok.

Hope that helps.


Rob Stewart

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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]

Reply via email to