Dear,
Is there any way to write excel files using aspose.cells for .NET directly as the generator works “Direct-To-File Mode” similar to the way in: http://www.aspose.com/documentation/.net-components/aspose.pdf-for-.net/writing-pdf-directly.html
Your response is really appreciated.
This message was posted using Page2Forum from [Saving Files - Aspose.Cells for .NET]
Hi,
I think, you are looking for reducing memory consumption. What you can do is to partially load workbook and work with it.
Please see this thread for a code example. The code just loads the sheet at index 0 and do not load other sheets.
I have also attached the source.xlsx too.
Please download: Aspose.Cells for .NET (Latest Version)
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”];
Assert.AreEqual(cellA1OfSheet2.Type, CellValueType.IsNull);
Assert.AreEqual(cellA1OfSheet3.Type, CellValueType.IsNull);