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

Free Support Forum - aspose.com

Issue with Aspose.Cells

Hi,

I have an issue with Aspose.Cells. I am moving from TeamCity to Azure DevOps and trying to set a build and deploy. However project is old and I did a lot of updates.
Currently I have error: Error CS1503: Argument 1: cannot convert from ‘Aspose.Cells.Style’ to ‘string’.

Here is a part of code:
private static void GetStyles(Workbook workBook, Worksheet sheet)

    {
        var styleIndex = workBook.CreateStyle();
        var style = workBook.GetNamedStyle(styleIndex);
        style.Font.IsBold = true;
        for (int i = 0; i < 100; i++)
        {
            sheet.Cells[0, i].SetStyle(style);
        }
    }

Could you help out with this?

@AhmedB,
Could you please try following code and let us know your feedback.

private static void GetStyles(Workbook workBook, Worksheet sheet)
{
    var styleIndex = workBook.CreateStyle();            
    styleIndex.Name = "styleIndex";
    var style = workBook.GetNamedStyle("styleIndex");
    style.Font.IsBold = true;
    for (int i = 0; i < 100; i++)
    {
        sheet.Cells[0, i].SetStyle(style);
    }
}