Saturday, March 24, 2012

Open 10MB size Excel file

Hi All,

I am working on ASP .NET framework 1.1 technology. All i want to achieve is read the "Worksheet" names of an Excel Workbook. And i am able achieve the same using the code given below.

Now, the pain is if I try to use objWorkbooks._open for an excel file of 10MB size the system goes forever. Please advice.

/************************************************************************************************************************************************************************************************* /

objExcel =

new Application();

objExcel.Visible =

false;

objWorkbooks = objExcel.Workbooks;

objWorkbook = objWorkbooks._Open(filePath, objMissing, objMissing,objMissing,

objMissing,objMissing, objMissing,objMissing,objMissing,objMissing,objMissing,objMissing,objMissing);

int count = objWorkbook.Worksheets.Count;

string sheetName;

for(int i =1;i<=count;i++)

{

objWorksheet = (_Worksheet)objWorkbook.Worksheets[i];

sheetName +=" "+ objWorksheet.Name;

}

Response.Write(sheetName);

/*************************************************************************************************************************************************************************************************/

Try splitting the excel sheet. There are many tools availsble to split the excel sheets. Following is one among them,

http://www.freedownloadscenter.com/Business/MS_Office_Add-ins/SPLIT.html

I think splitting is the only way out of this.

0 comments:

Post a Comment