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

Free Support Forum - aspose.com

Add hyperlink to chart


is there a way to add hyperlink to chart through aspose.cells for java? There is a way to add hyperlink to shape using shape.addHyperlink, or to cell using worksheet.getHyperlinks.add(), so I wonder if there is some similar option for Chart?



Thanks for your query.

I could not find such a feature in MS Excel when manually trying to add hyperlink to a chart in Excel worksheet. Aspose.Cells follows MS Excel standards and specifications for chart and shapes. If you still think this is possible in MS Excel, kindly do provide details and sample file (containing a hyperlinked chart), we will check how to do it via Aspose.Cells APIs.

Hi, the example is attached, there is a hyperlink (www.google.com) on chart, you can check it out.

chart-with-hyperlink.zip (9.5 KB)


Thanks for the file.

I lately found the feature is supported in MS Excel so Aspose.Cells also supports this already. Please see the sample code for your reference:
Sample code:

Workbook workbook = new Workbook("f:\\files\\chart-with-hyperlink.xlsx");
         //Get the Chart from the first worksheet.
         Chart source = workbook.getWorksheets().get(0).getCharts().get(0);
         ChartShape cshape = source.getChartObject();
         //Add/update hyperlink for the chart shape.
         //Save the Worksheet

Hope, this helps a bit.