Free Support Forum - aspose.com

nSeries error

Can anyone tell me why this line works with no problem using an Excel 2003 .xls template file but throws an error using an Excel 2007 .xlsx file?

m_oChart.NSeries[0].Values = "D64:D174";

There is an existing series in the template file chartsheet and this line updates the existing series with a new series address.

We are using Aspose Cells for .Net version 4.4.3.1 (yes I know its an old one). This application has been running flawlessly since 2008 but my client now needs larger workbooks exported to Excel (more than 256 columns), so I'm making a simple change to use the Excel2007xlsx file format.

As long as I use and refer to an Excel 2003 xls file there is no problem, but using an Excel 2007 xlsx file it errors with:


"Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index"
'm_oChart.NSeries[0]' threw an exception of type 'System.ArgumentOutOfRangeException' Aspose.Cells.ASeries {System.ArgumentOutOfRangeException}

More code bits:

Old Code for Excel designer workbook v 2003 xls (just the pertinent lines):

CellsLicense.SetLicense("Aspose.Cells.lic");
Workbook m_oWBIMSRpt = new Workbook();
sFileName = "SegmentsReport.xls";
path = HttpContext.Current.Server.MapPath("~/templates");
templatefile = path + "/" + sFileName;
m_oWBIMSRpt.Open(templatefile);
m_oIMSChartSheet = m_oWBIMSRpt.Worksheets[1].Charts;
Chart m_oChart = m_oIMSChartSheet[0];
m_oChart.Type = ChartType.Scatter;
m_oChart.NSeries[0].Values = "D64:D174"

New Code for Excel 2007 xlsx

CellsLicense.SetLicense("Aspose.Cells.lic");
Workbook m_oWBIMSRpt = new Workbook();
sFileName = "SegmentsReport.xlsx";
path = HttpContext.Current.Server.MapPath("~/templates");
templatefile = path + "/" + sFileName;
m_oWBIMSRpt.Open(templatefile, FileFormatType.Excel2007Xlsx);
m_oIMSChartSheet = m_oWBIMSRpt.Worksheets[1].Charts;
Chart m_oChart = m_oIMSChartSheet[0];
m_oChart.Type = ChartType.Scatter;
m_oChart.NSeries[0].Values = "D64:D174"

It does a lot of processing to add data to the workbook in Sheet1 and then to the chart series in a ChartSheet. Everything works perfectly except that line.

It make no sense as even this older version of Aspose Cells should handle this. Attached is the v2007 template file.

Thanks,

Rob

Hi,


Thanks for the template file and sharing some details.

Well, since you are using older Aspose.Cells v4.4.3.x which I think might have an issue with MS Excel 2007 XLSX file format regarding certain chart types, may be at that time XLSX specifications were not completely leaked out, so your version might have limited support for XLSX file format for Charts with their certain types. I am afraid, we cannot help you much regarding v4.4.3.x version.

We highly recommend you to kindly try and upgrade to our latest version/fix (e.g v8.4.2 (latest version)) which should work fine. Over the years, we have made lots of enhancements, included new features and included lots of fixes in the newer versions of the product. The latest versions of the product do support to read, write, manipulate, render or print Advanced MS Excel (2007/2010, 2013) file formats (e.g XLSX, XLSM, XLSB etc.). Moreover, we cannot evaluate or incorporate fixes to older versions, the fixes are only included into the latest versions based on latest APIs set. So, if you find any issue in latest version of the product, we are bound and try to fix it for the users. And, if you find any issue in your code segments, while upgrading to latest APIs of the component, we are here to help you.

Thank you.


Thanks for your reply. At least my code was correct.


I certainly understand that supporting older versions is not something you can continue to do. I am disappointed that this feature does not work in the version as you claimed it did at the time. Having worked with you previously I know that you did endeavor support your product during that version’s life cycle.

I’ll discuss with my client what options they have and see if an upgrade is something they wish to do.

Regards…

Hi,

Thanks for your understanding and using Aspose.Cells.

Upgrading to latest version will give you benefit because the latest version contains lot of bug fixes, news features and enhancements over the years. Also, we fix bugs in the latest versions only so if you encounter any error, you can report it to us and get it fixed. Please take the help of this forum while upgrading your code. We will look into your issues and help you asap.