Click here to Skip to main content
15,923,120 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have upload one excel file with the multiple sheets.And convert the excel document to data table and validate the data table.many validation process in this case.in this excel have many heading like item number,manufacturer number ... i have validate if any empty cell in mandatory field to store the error message in one table and the finally i will show the error table and correct the cells against the heading.Now the problem is i convert the excel to data table some excel files have more rows and columns(65536,1048576 actual excel row) on that time (Exception of type 'System.OutOfMemoryException' was thrown.) exception is thrown.how to fix the particular row column of the excel document.

What I have tried:

C#
FileStream stream = File.Open(SourceUpload.Fullpath, FileMode.Open, FileAccess.Read);
IExcelDataReader excelReader = ExcelReaderFactory.CreateOpenXmlReader(stream);
ds = excelReader.AsDataSet();

Above code i can't fix the particular rows and columns. How to do it.
Posted
Updated 27-Nov-16 19:39pm

1 solution

Try using the 5th method from the readme :
C#
//5. Data Reader methods
while (excelReader.Read())
{
    //excelReader.GetInt32(0);
}
 
Share this answer
 
Comments
Raja Ganapathy 28-Nov-16 2:12am    
Inside the method i give the row,column value excelReader.GetInt32(1000,1000)?
Mehdi Gholam 28-Nov-16 2:35am    
Read the documentation, but I presume it is like reading from any other data source and you provide the column index as a parameter (0 in the above example = column 0 in the row just read)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900