Delete chart

Hi,

I use aspose.cells on a vb.net project.
I open an Excel document where there are two charts (“Chart 3” and “Chart 2”).
In my treatment i must, in some cases, delete the first chart.
How can i do ?

Thanks for advance.

Hi,

Thanks for your inquiry.

May the following sample code help you for your need, kindly consult it:

Sample code:

Dim book As Workbook = New Workbook()
book.Open("f:\test\chartsBook.xls")
'Get the first worksheet charts collection.
Dim charts As Charts = book.Worksheets(0).Charts
'Delete the first chart in the sheet.
charts.RemoveAt(0)
book.Save("f:\test\removingachart.xls")

And be sure to use the latest version / hotfix.

Thank you.

Thanks a lot :slight_smile: