Question about setting style for a row

Just purchased Aspose.Excel. Could you please explain why method 1 does not work, whereas method 2 does work?

Method 1:

// Format first line bold.
sheet.Cells.Rows[0].Style.Font.IsBold = true;

Method 2:

// Format first line bold.
for ( int columnIndex=0; columnIndex<100; ++columnIndex )
{
sheet.Cells[0, columnIndex].Style.Font.IsBold = true;
}

The result of method 1 is that none of the cells are changed to bold font.

Thanks
Uwe

Hi Uwe,

Currently Row style setting only work for those cells without formattings. I will change this method to make it work as MS Excel.

Thank you Smile!

@zeta_software,
Aspose.Cells has replaced Aspose.Excel that is no more available now. This new product is much advanced in terms of features and performance as compared to its predecessor. You can set the style of the individual rows using Aspose.Cells as given below:

Workbook workbook = new Workbook();
workbook.Worksheets[0].Cells["A1"].Value = "Sample Data Row 1";
workbook.Worksheets[0].Cells["A2"].Value = "Sample Data Row 2";
Style style = workbook.CreateStyle();
style.Font.IsBold = true;
workbook.Worksheets[0].Cells.ApplyRowStyle(0,style, new StyleFlag() { FontBold = true });
workbook.Worksheets[0].AutoFitColumns();
workbook.Save("Output.xlsx");

For more information on formatting cells using GetStyle and SetStyle method, refer to the following article:
Format Cells using GetStyle and SetStyle Methods

Here is the link to the free trial version of this new product:
Aspose.Cells for .NET(Latest version)

You can download a ready to run solution here that can be used to test different features of this product without any coding.