Hello,
I am working on a wpf app and I’m using aspose.cells to process excel files.
I’m currently struggling with an out of memory exception.
This is a sample of code showing what I’d like to achieve:
Task.Factory.StartNew(() =>
{
Workbook workbook = new Workbook(filePath);
Workbook template = new Workbook();
template.Copy(workbook);
Worksheet templateSheet = template.Worksheets[0];
templateSheet.Cells.ClearRange(this.configuration.HeaderRow, 0, templateSheet.Cells.MaxRow,
templateSheet.Cells.MaxDataColumn);
string templatePath = string.Format(CultureInfo.InvariantCulture, “{0}\{1}”, this.Configuration.OutputDirectory,
“template.xlsx”);
template.Save(templatePath);
foreach (Staff staff in staffsTemp)
{
Workbook workbookStaff = new Workbook(templatePath, opt);
Worksheet worksheetStaff = workbookStaff.Worksheets[0];
int maxDataRowSourceSheet = workbook.Worksheets[0].Cells.MaxDataRow;
}
})
The exception is thrown at the first construction “Workbook workbook = new Workbook(filePath);”
Thank you for your help.
Regards