Finding if an Excel has a Chart

Hello support,

Is there a way to identify if an Excel has a chart inside it? Please point me to a code snippet.

Thanks.

Hi,

Thanks for your posting and considering Aspose.Cells.

If there is a chart in a worksheet, then Worksheet.Charts.Count will be greater than 0.

Please see the following sample code for more help.

C#


string filePath = @“F:\Shak-Data-RW\Downloads\source.xlsx”;


Workbook workbook = new Workbook(filePath);

Worksheet worksheet = workbook.Worksheets[0];


if (worksheet.Charts.Count > 0)

Console.WriteLine(“Excel file has chart inside this sheet.”);