Hi,
You can try to load your workbook partially.
Please download latest version:
Aspose.Cells
for .NET v7.1.0.6
Please try the following code with the sample xlsx file given in my link.
a) - If you just want to load data of one worksheet, please try the following code:
C#
LoadOptions loadOptions = new LoadOptions(LoadFormat.Xlsx);
LoadDataOption dataOption = new LoadDataOption();
dataOption.SheetIndexes = new int[] { 0 };
dataOption.ImportFormula = true;
loadOptions.LoadDataOnly = true;
//Specify the LoadDataOption
loadOptions.LoadDataOptions = dataOption;
//Create a Workbook object and opening the file from its path
Workbook wb = new Workbook(Constants.sourcePath + “Source.xlsx”, loadOptions);
Worksheet sheet1 = wb.Worksheets[0];
Worksheet sheet2 = wb.Worksheets[1];
Worksheet sheet3 = wb.Worksheets[2];
Cell cellA1OfSheet1 = sheet1.Cells[“A1”];
Cell cellA1OfSheet2 = sheet2.Cells[“A1”];
Cell cellA1OfSheet3 = sheet3.Cells[“A1”];
Debug.Assert(cellA1OfSheet2.Type == CellValueType.IsNull, “This message should not appear”);
Debug.Assert(cellA1OfSheet3.Type == CellValueType.IsNull, “This message should not appear”);
Dim loadOptions As LoadOptions = New LoadOptions(LoadFormat.Xlsx)
Dim dataOption As LoadDataOption = New LoadDataOption()
dataOption.SheetIndexes = New Integer() {0}
dataOption.ImportFormula = True
loadOptions.LoadDataOnly = True
'Specify the LoadDataOption
loadOptions.LoadDataOptions = dataOption
'Create a Workbook object and opening the file from its path
Dim wb As Workbook = New Workbook(filePath, loadOptions)
Dim sheet1 As Worksheet = wb.Worksheets(0)
Dim sheet2 As Worksheet = wb.Worksheets(1)
Dim sheet3 As Worksheet = wb.Worksheets(2)
Dim cellA1OfSheet1 As Cell = sheet1.Cells("A1")
Dim cellA1OfSheet2 As Cell = sheet2.Cells("A1")
Dim cellA1OfSheet3 As Cell = sheet3.Cells("A1")
Debug.Assert(cellA1OfSheet2.Type = CellValueType.IsNull, "This message should not appear")
Debug.Assert(cellA1OfSheet3.Type = CellValueType.IsNull, "This message should not appear")
b) - If you just want to get the all sheets’ name, please use the following code:
C#
Thanks for the reply, But the above code does not help. I am already using Aspose v7.1.1.0 and my workbook contains only one worksheet. after little trial and error when i reduce the file rows to 200k it works. That too first time only, if i try again it throws out of memory,( unless i restart my IIS).
Attaching the file. Below code last line throws Out Of Memory Exception.
var file = Request.Files[“excelFile”];
License license = new License();
license.SetLicense(“Aspose[1].Cells.lic”);LoadDataOption dataOption = new LoadDataOption();
dataOption.SheetIndexes = new int[] { 0 };
dataOption.ImportFormula = true;
loadOptions.LoadDataOnly = true;
LoadOptions loadOptions = new LoadOptions(LoadFormat.Xlsx);loadOptions.LoadDataOptions = dataOption;Workbook workbook = new Workbook(file.InputStream);
My dev environment Processor:Intel i7 2.80Ghz, Ram:8GB, Win 7, IISExpress, .Net 4, Asp.Net mvc 3.
Hi,
Thanks for your feedback and providing us your source file.
We have logged this issue in our database. Development team will look into it and once we will have some update/fix relating to this issue, we will let you know asap.
This issue has been logged as CELLSNET-40381.
Hi,
I tested your code with your template file on desktop and Web applications, it works fine here with Aspose.Cells for .NET 7.1.1
Sample code:
string file = “e:\test2\Sample+file±+02_10_12_2.xlsx”;
LoadDataOption dataOption = new LoadDataOption();
dataOption.SheetIndexes = new int[] { 0 };
dataOption.ImportFormula = true;
LoadOptions loadOptions = new LoadOptions(LoadFormat.Xlsx);
loadOptions.LoadDataOnly = true;
loadOptions.LoadDataOptions = dataOption;
Workbook workbook = new Workbook(file);
Kindly create a sample project with v7.1.1, zip it and attach it here to reproduce the issue on our end. we will check it soon.
(My System: OS Win7, Processor: Intel Core Duo 2.0 GHz, RAM: 2GB, VS.NET 2008 etc. )
Thank you.