Chart ToImage fails when Horizontal Access is not contiguous

Hello,

The following stack trace is encountered when attempting to save an image of the chart in this workbook. Note that if you choose Select Data on the chart in Excel and review the Horizontal axis, not all of the items on the horizontal axis are included (some are excluded). If the excluded rows are deleted then the code below works as expected.

Failing Chart.zip (40.6 KB)

Code to reproduce:

    [Test]
    public void foo47()
    {
        (new Workbook(@"Failing Chart.xlsx")).Worksheets["Display"].Charts["Chart 1"].ToImage(@"c:\Data\temp\out.png");
    }
System.ArgumentOutOfRangeException : Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
   at System.Collections.ArrayList.get_Item(Int32 index)
   at \u0003\u0017\u0015\u0017.\u0002(ArrayList \u0002, \u000f\u001b\u001a\u0017 \u0008)
   at \u000e\u0015\u001a\u0017.\u0002(\u0002\u0002\u001a\u0017 \u0002, \u0005\u0019\u000f\u0017 \u0008)
   at \u000e\u0015\u001a\u0017.\u0002(\u0002\u0002\u001a\u0017 \u0002)
   at \u0002\u0002\u001a\u0017.\u0006\u0016\u001a\u0017\u0003\u0016\u0008()
   at \u0002\u001a\u0016\u0017.\u000f\u0015\u0016\u0017\u0003\u0016\u000e()
   at \u0002\u001a\u0016\u0017.\u0002()
   at \u0002\u001a\u0016\u0017.\u000e\u0015\u0016\u0017\u0003\u0016\u0002\u000f()
   at \u0002\u001a\u0016\u0017.\u0008()
   at \u0002\u001a\u0016\u0017.\u000e\u0015\u0016\u0017\u0003\u0016\u0005()
   at \u000e\u0010\u001a\u0017.\u0002(Stream \u0002, Chart \u0008)
   at Aspose.Cells.Charts.Chart.ToImage(Stream stream, ImageOrPrintOptions options)
   at Aspose.Cells.Charts.Chart.ToImage(String imageFile, ImageOrPrintOptions options)
   at Aspose.Cells.Charts.Chart.ToImage(String imageFile)
   at QueBIT.ReportWORQ.UnitTestsV5.Sandbox.ADW.foo47() in C:\Users\AndyWeiss\repos\ReportWORQ\QueBIT.ReportWORQ.UnitTestsV5\Sandbox\ADW.cs:line 67
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)

Thank you,
-Andy

@weissa,

After initial testing, I was able to reproduce the issue you mentioned by using your template XLSX file. I found an exception “System.ArgumentOutOfRangeException : Index was out of range. Must be non-negative and less than the size of the collection. (Parameter ‘index’)” when rendering the chart to image.

We require thorough evaluation of the issue. We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): CELLSNET-56140

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

@weissa,

We are happy to announce that your issue (logged as “CELLSNET-56140”) has been resolved. The fix/enhancement will be included in the next release (Aspose.Cells v24.7) scheduled for release this week. We will let you know when the next version is released.

The issues you have found earlier (filed as CELLSNET-56140) have been fixed in this update. This message was posted using Bugs notification tool by johnson.shi

I’ve confirmed the fix works as expected.

Thank You,
-Andy

@weissa
Thank you for your feedback. You are welcome. If you have any questions, please feel free to contact us at any time.