The following snippet crashes with a System.NullReferenceException at the line: ws.Cells.ApplyRowStyle(1, abold, sf);
Aspose.Cells.Workbook wb = new Aspose.Cells.Workbook();
Aspose.Cells.Worksheet ws = wb.Worksheets[0];
Aspose.Cells.Style a1 = new Aspose.Cells.Style();
a1.Number = 7;
Aspose.Cells.Style aText = new Aspose.Cells.Style();
aText.HorizontalAlignment = Aspose.Cells.TextAlignmentType.Left;
Aspose.Cells.StyleFlag sf = new Aspose.Cells.StyleFlag();
sf.FontBold = true;
Aspose.Cells.Style abold = new Aspose.Cells.Style();
abold.Font.IsBold = true;
ws.Cells[0,0].PutValue(9.99M);
ws.Cells[0,0].SetStyle(a1);
ws.Cells[1,0].PutValue(9.99M);
ws.Cells[1,0].SetStyle(a1);
ws.Cells[1,1].PutValue(“Text”);
ws.Cells[1,1].SetStyle(aText);
// uncomment the next line and the ApplyRowStyle will not crash but it removes the formatting from [1,0]
// ws.Cells[1,1].SetStyle(abold, sf);
// Crashes here if the previous line is commented out
ws.Cells.ApplyRowStyle(1, abold, sf);
wb.Save(@"\tmp\test_rowstyle.xlsx");
Maybe I am using it incorrectly but the ApplyRowStyle is also removing the formatting from the 1,0 cell.