We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Cells.Columns obsolete Cells.Rows obsolete

Hi,

The documentation and tooltip help say that Cells.Columns and Cells.Rows are obsolete

"NOTE: This member is now obsolete. It will be removed 12 months later since the fix 4.4.1.8 in March 2008. Aspose apologizes for any inconvenience you may have experienced."

However the documentation fails to mention what part of the API should be used instead!

What is the new improved way to access the column and row collection

Kind regards Ed.

Hi,

Well, We have introduced some new APIs i.e., Cells.ApplyColumnStyle and Cells.ApplyRowStyle methods etc. So, if you are using Row.ApplyStyle or Row.Style members, you may use Cells.ApplyRowStyle instead. Similarly if you are using Column.ApplyStyle or Column.Style members, you may use Cells.ApplyColumnStyle() instead.

Sample code:

Workbook wb = new Workbook();
Worksheet sheet = wb.Worksheets[0];
Style style1;
StyleFlag flag1;

style1 = wb.Styles[wb.Styles.Add()];
style1.Custom = "yyyy-mm-dd";
flag1 = new StyleFlag();
flag1.NumberFormat = true;

//Apply style to the first column.
sheet.Cells.ApplyColumnStyle(0,style1, flag1);

Style style2;
StyleFlag flag2;

style2 = wb.Styles[wb.Styles.Add()];
style2.Number = 39;
flag2 = new StyleFlag();
flag2.NumberFormat = true;

//Apply style to the 11th row.
sheet.Cells.ApplyRowStyle(10,style2, flag2);

wb.Save("d:\\test\\rowandcolumn_formattings.xls");

Thank you.