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

Free Support Forum - aspose.com

Referencing multiple charts on Worksheets


I have some code that takes a bitmap of various charts across various worksheets:

Dim mysheet As Worksheet = _appExcel.Worksheets(sSheet)

Dim bitmap As System.Drawing.Bitmap = mysheet.Charts(iEntityNumber - 1).ToImage()

The problem I'm facing is being able to specify the chart I'm after if there are more that one chart on the same worksheet.

If there are ten charts, how do I reference the 6th one? (and the answer isn't always .charts(5), especially if there were originally 20 charts, and 10 have been deleted!)



Hi Steve,

Well, I think you may try to get/access charts by its names rather than indexed positions. Then, you can take the image of the chart.

Dim bitmap As System.Drawing.Bitmap = mysheet.Charts(sChartName).ToImage()

If you have multiple charts in a worksheet and you want to get a specific chart, I think you should get the chart by its name rather than indexed position(which might not be always right - as you mentioned in your case).

Thank you.