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

Free Support Forum - aspose.com

SheetRender.ToImage throws Index out of range exception in specific case

Aspose.Cells version: 18.6.0.0 and 18.3.0.0
The issues does not reproduce in Aspose.Cells 17.4.0.0

Sample code to reproduce the issue:

    var workbook = new Workbook();
    workbook.Worksheets[0].PageSetup.PrintArea = "A1:A1";
    workbook.Worksheets[0].Cells["A1"].PutValue("");
    var test = workbook.Worksheets[0].Cells["A1"].Characters(0, 0);


    var opt = new ImageOrPrintOptions
    {
            PrintingPage = PrintingPageType.IgnoreBlank,
            ImageFormat = ImageFormat.Png,
            OnePagePerSheet = true,
            OnlyArea = true
    };
    var sh1 = new SheetRender(workbook.Worksheets[0], opt);
    var image = sh1.ToImage(0);

Saving the workbook before calling ToImage works-around the issue.

@adrian.anton

We were able to observe the issue but we need to look into it more. We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.

This issue has been logged as

CELLSNET-46207 - Index out of range exception in SheetRender.ToImage method

@adrian.anton,

This is to inform you that we have fixed your issue(logged earlier as “CELLSNET-46207”) now. We will soon provide you the fixed version after performing QA and incorporating other enhancements and fixes.

@adrian.anton,

Please try our latest version/fix: Aspose.Cells for .NET v18.6.5:
Aspose.Cells for .NET v18.6.5 (.NET 2.0)
Aspose.Cells for .NET v18.6.5 (.NET 4.0)

Your issue should be fixed in it.

Let us know your feedback.

The issues you have found earlier (filed as CELLSNET-46207) have been fixed in Aspose.Cells for .NET v18.7. Please also check the document/article for your reference: https://docs.aspose.com/display/cellsnet/Installation