EasyXLS
http://forum.easyxls.com/

Why does Applying Border Formatting change numberFormat
http://forum.easyxls.com/viewtopic.php?f=5&t=1261
Page 1 of 1

Author:  teniel [ Sun Oct 18, 2009 10:47 am ]
Post subject:  Why does Applying Border Formatting change numberFormat

I have an Excel workbook. The numberformat "###,###" is applied to some of the columns.

Assuming I do not touch any of the formatting of the cells, then this numberFormat stays. However if I apply a border format


Code:
//for (int j=1;j<20;j++) {
                           //   xlsMainTable.easy_getCell(row,j).setBorderStyles(Border.BORDER_THIN, Border.BORDER_NONE,Border.BORDER_THIN, Border.BORDER_THIN);
                           //   xlsMainTable.easy_getCell(row+1,j).setBorderStyles(Border.BORDER_NONE, Border.BORDER_THIN, Border.BORDER_THIN, Border.BORDER_THIN);
                           //}


then the numberFormat is removed, even though I would have claimed they have nothing to do with each other

Is there a way of getting around this?

Thank you

Author:  daniela [ Mon Oct 19, 2009 7:46 am ]
Post subject: 

Formatting the cells overrides the column formatting.

You can create a clone after the column ExcelStyle, apply the border settings to the clone and set the style for the cells.

Code:
ExcelStyle xlsClonedStyle = xlsColumn. getStyle().Clone();
xlsClonedStyle. setBorderStyles(Border.BORDER_THIN, Border.BORDER_NONE,Border.BORDER_THIN, Border.BORDER_THIN);
xlsMainTable.easy_getCell(row+1,j).setStyle(xlsClonedStyle);

Author:  teniel [ Tue Oct 20, 2009 10:18 am ]
Post subject:  Feedback

Thank you Daniela for your posting. Unfortunately this did not work and I got much the same results as before...
Best wishes
Teniel

Page 1 of 1 All times are UTC - 4 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/