EasyXLS
http://forum.easyxls.com/

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

Author:  levi [ Wed Jan 16, 2008 5:05 pm ]
Post subject:  Formatting Ranges

Can you set the formatting for a particular range? I know that with the ExcelTable class you can do a:

Code:
ExcelStyle xlsStyle = new ExcelStyle("Calibri",10,false,false,Color.Empty,Color.Empty)
xlsTable.easy_SetRangeStyle("A1:D11",xlsStyle);


But then after that, can you then go through and overwrite the style of say row 2 just to adjust that it's italicized without overwriting the other settings that it had?

Author:  daniela [ Thu Jan 17, 2008 6:28 am ]
Post subject: 

You can get the style for A1 cell for example and modify this style.
ExcelStyle xlsStyle = xlsTable.easy_getCell(0,0).getStyle().Clone()
or
ExcelStyle xlsStyle = xlsTable.easy_getRowAt(2).getStyle().Clone()
xlsStyle.setFont("Calibri")
xlsStyle.setFontSize(11)
xlsStyle.setBold(false)
xlsStyle.setItalic(false)
xlsStyle.setForeground(Color.Empty)
xlsTable.easy_setRangeStyle("A1:D11", xlsStyle)

Author:  levi [ Thu Jan 17, 2008 1:37 pm ]
Post subject: 

Daniela wrote:
You can get the style for A1 cell for example and modify this style.
ExcelStyle xlsStyle = xlsTable.easy_getCell(0,0).getStyle().Clone()
or
ExcelStyle xlsStyle = xlsTable.easy_getRowAt(2).getStyle().Clone()
xlsStyle.setFont("Calibri")
xlsStyle.setFontSize(11)
xlsStyle.setBold(false)
xlsStyle.setItalic(false)
xlsStyle.setForeground(Color.Empty)
xlsTable.easy_setRangeStyle("A1:D11", xlsStyle)


Ahh, I see. so basically you would have some default ExcelStyle (xlsStyleDefault) and you would clone it, set whatever different you wanted to set and then set the style for your range. Thanks!

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