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

Free Support Forum - aspose.com

How-to get the id of a chart in a worksheet

Hi,
I need to get the Id of chart drawing in a worksheet.
With the openxml SDK, I use the GraphicFrame.NonVisualGraphicFrameProperties.NonVisualDrawingProperties.Id property
How to do this with aspose.cells ?

Best regards
Christophe

Hi Christophe,


Thank you for using Aspose products.

Please use the Name property exposed by the Chart class to get the chart’s name. Please check the below provided code snippet for elaboration purposes.

C#

Workbook book = new Workbook(myDir + “sample.xlsx”);
Worksheet sheet = book.Worksheets[“Sheet Name”];
foreach (Chart chart in sheet.Charts)
{
Console.WriteLine(chart.Name);
}

Please feel free to write back in case you need further assistance.

Hi,
Your code snippet list all chart name of a worksheet but not the chart id.
In openxml the chart name is returning by GraphicFrame.NonVisualGraphicFrameProperties.NonVisualDrawingProperties.Name property
I need the chart id (in the attached file, the chart id is “1028” and the chart name is “Graphique 1”)

Regards
Christophe

Hi Christophe,


Unfortunately, retrieving the numeric chart Id may not be supported at the moment therefore we have logged a feature request under ticket Id CELLSNET-42686. We will soon look into this matter to provide a solution or a workaround for the time being. As soon as we receive some updates, we will post here for your kind reference.

We are sorry for the inconvenience.

Hi,
there is no way to identify two charts (or more) in a worksheet
This is a blocking problem in my product.

Have you planned this ticket for a future version ? When ?

Regards,
Christophe

Hi Christophe,


Thank you for your patience with us.

With current implementation of Aspose.Cells API, you can identify a chart by its name as discussed here. Please note, the chart name is unique within a worksheet so no two charts could have the same name.

Regarding the ticket logged earlier as CELLSNET-42686, unfortunately it has not been resolved yet. We have recorded your recent comments to the ticket, and have requested the concerned development team member to share the feasibility of the requested feature. Please spare us little more time to get back to you with updates in this regard.

Hi,
Your affirmation that “the chart name is unique within a worksheet so no two charts could have the same name.” is not right, the workbook attached has two chart with the same name in the worksheet. This is a hand-made workbook.

Regards,
Christophe Mari

Hi Christophe,


We have checked your provided spreadsheet, the first worksheet does have two charts with the same name. We have attached the spreadsheet to the ticket already associated with this thread, and requested the development team to analyze it further. We will let you as soon as we receive more updates in this regard.

We are sorry for the inconvenience caused to you.

Hi,
Have you planned this ticket ?

Regards,
Christophe

Hi Christophe,

Thanks for your posting and using Aspose.Cells

We are afraid, there is no update for you at this moment. However, we have logged your comment in our database against this issue and requested the development team to provide some fix or ETA for this issue. Once, there is good news for you, we will let you know asap.

Hi,

Thanks for your using Aspose.Cells.

We have fixed this issue. Please use Shape.Id (or Chart.ChartObject.Id ) property.

Please download and try the latest fix: Aspose.Cells for .NET v8.2.2.3 and let us know your feedback.

It’s worked fine.
Thank you

Christophe Mari

Hi Christophe,

Thanks for your feedback and using Aspose.Cells.

It is good to know that your issue is fixed with the latest version. Let us know if you encounter any other issue, we will be glad to look into it and help you further.

Hi,
A little precision, it’s worked fine only for openxml workbook.
For xls woorkbook, the id is wrong.

Best regards,
Christophe Mari

Hi Christophe,

Thanks for your feedback and using Aspose.Cells.

Kindly provide some xls workbook with your chart and chart id to test this issue at our end. Please also let us know what are the steps you take to know the chart id of your chart in Microsoft Excel.