Access chart in design file


#1

Hi,

I'm evaluating Aspose.cell for my client. The needs are:

use a xls file as a template, and fill it with data from database. Some stuff seem to work exept one.

In the template we have chart (named) so the question :

How access this chart with their name ?

It's seem all the chart are in the collection DesignerCharts but all are empty. How use it ? I need to update the chart data source.

Thanks you for the answer.

David.


#2

Hi,

Thanks for considering Aspose.

Do you have a custom user defined chart in your template file?

Well you may access a chart by its index number. following is the sample code:

int index=0;

Chart chart = worksheet.DesignCharts[index];

Regards

Amjad Sahi

Aspose Nanjing Team


#3

Hi David,

Could you please post your xls file here? Thank you.


#4

This is a sample xls template with 3 charts


#5

This is the watch i have in Visual studio when i parse the first chart.

David


#6

Hi David,

To changed the data source, you can try:

Workbook wb = new Workbook();

wb.Open("d:\\test\\stats.xls");

wb.Worksheets[0].DesignCharts[0].NSeries.Add("A1:A5", true);

wb.Save("d:\\test\\abc.xls");

Currently there are limitations to access chart design file. We are working to convert chart data in designer file to Aspose.Cells chart object model to allow you access them same as charts created at run time. It will take several month to make it.


#7

I have a dozen or so web pages that contain charts. I found the simplest was to update the charts was to have a hidden worksheet with chart's datasource set to a range on that hidden worksheet. Then all I have to do when I save the report is update the range with the appropriate data and the chart is automatically updated.

One of my reports has up to 10 tabs with a separate report on each tab and 5 charts on each report. The hidden worksheet method works flawlessly.

Rick