Please see the following code and stack trace.
public bool GetChartImage(string address, Stream stream, int scale)
{
if (scale == 0) scale = 100;
// Try to get the chart by the name
Chart chart = Worksheet.Charts[address];
if (chart == null)
{
// See if address is a cell location and there's a chart name in that cell location?
var chartName = GetRangeValueOrNull(address);
chart = Worksheet.Charts[chartName];
if (chart == null)
return false;
}
var saveHeight = chart.ChartObject.HeightScale;
var saveWidth = chart.ChartObject.WidthScale;
var options = new ImageOrPrintOptions()
{
ChartImageType = ImageFormat.Png,
ImageType = Aspose.Cells.Drawing.ImageType.Png
};
chart.ChartObject.HeightScale = Math.Min(400, Math.Max(10,scale));
chart.ChartObject.WidthScale = scale;
chart.ToImage(stream, options);
chart.ChartObject.HeightScale = saveHeight;
chart.ChartObject.WidthScale = saveWidth;
return true;
}
at System.Array.SorterObjectArray.IntrospectiveSort(Int32 left, Int32 length)
at System.Array.Sort(Array keys, Array items, Int32 index, Int32 length, IComparer comparer)
at System.Collections.ArrayList.Sort(Int32 index, Int32 count, IComparer comparer)
at .()
at .( , Rectangle , )
at .( )
at . ()
at .(Boolean )
at . (Stream , Chart )
at Aspose.Cells.Charts.Chart.ToImage(Stream stream, ImageOrPrintOptions options)
at QueBIT.ReportWORQ.Engine.Excel.AsposeExcelWorksheet.GetChartImage(String address, Stream stream, Int32 scale) in C:\sc\ReportWORQ\QueBIT.ReportWORQ.Engine\Excel\AsposeExcelWorksheet.cs:line 132
at QueBIT.ReportWORQ.Engine.Generation.RuntimeReport.Run(IReportCalculateService rptCalcService, IExcelApplication xlApplication, IReportTelemetry reportTelemetry, StreamFactory streamFactory, JobStepStatus stepStatus) in C:\sc\ReportWORQ\QueBIT.ReportWORQ.Engine\Generation\RuntimeReport.cs:line 208
at QueBIT.ReportWORQ.Engine.Generation.RuntimeJobStep.<>c__DisplayClass78_1.g__RunReportBody|2(IRuntimeReport rpt) in C:\sc\ReportWORQ\QueBIT.ReportWORQ.Engine\Generation\RuntimeJobStep.cs:line 124
at System.Threading.Tasks.Parallel.<>c__DisplayClass17_0`1.b__1()