Accessing existing charts

Im using ASP.net version 3.5 wit C# and using Aspose.cells. Im trying to access an existing chart in an existing workbook. I can open the workbook and access cells and update there values, but im having trouble locating the charts within my spreadsheet and updating there Chart data ranges.


Any help would be much appreciated!!

Jack

This message was posted using Page2Forum from Setting Charts Data - Aspose.Cells for .NET

Hi,

Please see the document on how you may manipulate existing charts in the template file.
http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/manipulating-designer-charts.html

If you still could not evaluate, kindly do post your template file with sample code here, we will check it soon.

Thank you.

Hi,
tried working from that document, but no luck, hopefully ive not overlooked something obvious, here is my source code, ive attached my template file if it helps.
Workbook wb = new Workbook();
wb.Open(@"C:\\Users\JHumphrey\Documents\help.xls");
Aspose.Cells.Charts.Chart chart = wb.Worksheets[0].Charts[0];

chart.NSeries.Add("A1:G3", true);

wb.Save(@"C:\\Users\JHumphrey\Documents\help.xls");

Compilation Error on line 3 - Error - "The type name 'Chart' does not exist in the type 'Aspose.cells.Charts'

Also if I run "wb.Worksheets[0].Charts.Count" after I open the workbook it returns 0 even though there is charts in my spreadsheet.

Thank You

Hi,

You might be using some older version before v5.0.0. The Chart APIs are in Aspose.Cells.Charts namespace, so you need to import that namespace into your program. I have attached latest version/fix v5.1.3.1. I have tested the following code, it works fine with it.

Workbook wb = new Workbook(@“e:\test\help.xls”);
MessageBox.Show(wb.Worksheets[0].Charts.Count.ToString()); //1 - OK
Aspose.Cells.Charts.Chart chart = wb.Worksheets[0].Charts[0];

chart.NSeries.Add(“A1:G3”, true);

wb.Save(@“e:\test\outhelp.xls”);


To know about complete hierarchy of Aspose.Cells namespaces, see the documents:
http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/overview-of-programmers-guide.html
http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/aspose.cells-for-.net-api-reference1.html

Thank you.

Hi,


Thanks for that using the new version works ok, however I don’t have a license to use version 5.1.3.1 and am still interested in changing the data range as I change the size of the data tables, is this possible or will I have to upgrade the license.

Kind Regards

Hi,

Well, I am afraid, you need to upgrade your subscription to use new versions/fixes of the product. The latest version has a lot of new features and enhancements for existing features.

Moreover, if you got some issues, we are bound to fix the issues and provide you the fix in quick time. This is possible if you have a valid license.

Thank you.