Problem with reading existing chart in XLS file

Hi,

I’ve tried to access previously created chart (by Excell) in XLS workbook, but failed.

Here is the code (pretty simple)

Workbook _wb = new Workbook();
_wb.LoadData(“c:\chartXls.xls”);
Chart _shape = _wb.Worksheets[0].Charts[0]; <-- breaks here and Charts.Count == 0


Could you please advise?

Thanks,
Peter

Hi Peter,

Please use Workbook.Open() method instead of LoadData(). The LoadData() method only loads data and formulas etc.

E.g.,

Aspose.Cells.Workbook workbook = new Aspose.Cells.Workbook();

workbook.Open(@"d:\test\chartXls.xls");

Aspose.Cells.Chart chart = workbook.Worksheets[0].Charts[0];

.

.

..

I tried the above code and it works fine.

Thank you.

Thaks a lot Amjad, I haven’t realized that there are several ways to load XLS, shame on me.