Free Support Forum -

Importing charts

Good evening,

I am still using a demo version of the software, but I am almost positive I will be buying a license either tonight or tomorrow.

Right now I am trying to add NSeries to an already existing chart from the excel spreadsheet that I opened.

Below is the code…

string path = HttpContext.Current.Server.MapPath(".");
string designerFile = path + “\templates\template.xls”;

Worksheets sheets = excel.Worksheets;
Cells cells = sheets[0].Cells;
Worksheet sheet = this.excel.Worksheets[“Graph-All”];
Chart chart = sheet.Charts[0];

string SeriesFormula = string.Format("’{0}’!{1}:{2}", sheetName, startCellName, endCellName);
chart.NSeries.Add(SeriesFormula, true);
chart.NSeries[chart.NSeries.Count - 1].Name = Name;

The problem that I am having is that I get an “index was out of range”.
But I know there is a chart in there from opening. Are charts not included upon opening?
Any insight would be appreciated.


Dear Patrick,

Thanks for your consideration.

Currently the charts read from designer file and charts set by chart api is separated.
Chart read from design file cannot be manipulated by api.

You can set everything of chart in your designer file, then input data to the data source cell. Then the result file will contain the changed data and result chart.

Please have a try.

I was also wondering if there is anyway that I can create a chart and choose a location for it. In Excel you are able to Create a Chart “As new sheet”.

Is this functionality available?

Hi, thanks for your consideration.

You can create a new sheet, then create chart on the new sheet.

What I mean is that there is a way to modify a graph so that it appears as a page all by itself. I don’t want a graph embedded in a worksheet.

If you right click a graph, one of the options is “Location”. By selecting this, you can choose:

As new sheet
As object in

I want to be able to set a graph “as new sheet”.

Aspose.Excel doesn’t support this feature now. Is this a critic requirement to you? I will investigate this issue and implement it in the near future.