We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Column and row restriction in XLSIO


I have a code which writes data of around 256+ columns into worksheet in a workbook. But after writing 256 columns I got an exception telling that arguement is out of range. I tried to resolve this by reading the currently installed excel version on my machine using IWorkbook's  Version property thinking that I would get more columns in Office 2010,but it gives only Off97to2003 everytime eventhough I have Office 2010 installed on my machine.

Need help
Thanks

3 Replies

PK Prakash Kumar D Syncfusion Team November 12, 2014 11:03 AM UTC

Hi Mahesh,

 

Thank you for using Syncfusion Products.

 

The reported exception is raised due to invalid workbook version. The default version in XlsIO is Excel97-2003. In that case, if you try to add 256+ columns, it will throw exception. We recommend you to assign it to Excel2007 or later. Please refer the below code snippets to avoid the exception. We have also shared a sample for your reference. Kindly refer to this and let us know if your issue is resolved.

 

Code Snippet:

 

 

//Step 1 : Instantiate the spreadsheet creation engine.

ExcelEngine excelEngine = new ExcelEngine();

//Step 2 : Instantiate the excel application object.

IApplication application = excelEngine.Excel;

 

application.DefaultVersion = ExcelVersion.Excel2010;

//If 2003 format file is opened and tried to add 256+ columns,

//workbook version must be assigned
IWorkbook workbook = application.Workbooks.Open(“sample.xls”);

workbook.version = ExcelVersion.Excel2010;

                                       

 

Sample Link:  Sample.zip

 

NOTE: This version settings doesn’t relate to the office version installed in the machine.

 

Please let us know if you need any clarification.

 

Regards,

Prakash Kumar.



MA Mahesh November 14, 2014 07:20 AM UTC

On changing the version of excel to Excel2007 I am unable to format the excel. My code has stopped working.
Please see the attahced screenshots.

Attachment: Chart_8b5860e1.zip


PK Prakash Kumar D Syncfusion Team November 17, 2014 12:19 PM UTC

Thank you for updating us.

 

We have analyzed the given screenshot and found that data labels are visible and makes the chart unreadable, for which we suggest you to disable the data labels in the series by using the below code snippets.

 

Code Snippet:

 

       

 IChartSeries series = chart.Series;

    series[0].DataPoints.DefaultDataPoint.DataLabels.IsValue = false;

                                        

However, if you could share us the below information in detail, it will be helpful to investigate further on this.

1.     Code snippets or the scenario you use that causes the program to stop working

2.     What kind of formatting you are trying to apply and what is the output you are getting?

 

Please clarify us with the above queries and let us know if you need any clarification.

 

Regards,

Prakash Kumar.


Loader.
Live Chat Icon For mobile
Up arrow icon