EasyXLS
http://forum.easyxls.com/

Cell Formatting
http://forum.easyxls.com/viewtopic.php?f=5&t=2216
Page 1 of 1

Author:  masseym [ Fri Jul 15, 2016 2:49 am ]
Post subject:  Cell Formatting

I am trying to do some cell formatting and am having a hard time getting it to work correctly.

I have a column of percentages. I set the column to be formatting as %. I then want the last row to be underlined with a border. When I do that, the percent column (or any column i have applied formatting to) go back to "raw" data.

' set column to be %
xlsTable1.easy_getColumnAt(13).setStyle(xlsStylePercent)
'write column values here...

' underline last row items (curcol = current column)
For myCol = 11 to curCol
xlsTable1.easy_getCell(Row, myCol).setStyle(xlsBorderBottom)
Next
' sum columns...
xlsTable1.easy_getCell(Row,12).setValue("=SUM(" & ColumnLetter(13) & StartRow & ":" & ColumnLetter(13) & Row & ")")
xlsTable1.easy_getCell(Row,13).setValue("=SUM(" & ColumnLetter(14) & StartRow & ":" & ColumnLetter(14) & Row & ")")
' make the sum row bold
xlsTable1.easy_getRowAt(Row).setStyle(xlsStyleBold) ' this removes the % formatting in column 13 and the underline..

Thoughts?

Author:  dpanazan [ Fri Aug 05, 2016 8:36 am ]
Post subject:  Re: Cell Formatting

This line of code:
xlsTable1.easy_getColumnAt(13).setStyle(xlsStylePercent)
sets the xlsStylePercent style only on the undefined cells in column 13.

Apply xlsStylePercent also in the code that write column values:
'write column values here...

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