Hi,
I'm trying to use the method .Clone() on the attached file but it throws a null reference exception.
The code:
public static IWorkbook Open(ExcelEngine engine, string excelPath, FileMode fileMode = FileMode.Open)
{
using (FileStream sourceStream = new FileStream(excelPath, fileMode))
{
var workbook = engine.Excel.Workbooks.Open(sourceStream);
sourceStream.Close();
return workbook;
}
}
public static IWorkbook Clone(ExcelEngine engine, string inputFilePath)
{
var inputWorkbook = Open(engine, inputFilePath);
var workbook = inputWorkbook.Clone();
inputWorkbook.Close();
return workbook;
}
The red line throw the exception.
You can subsitute the Open method with your "tutorial" methods to open a file (the open action is performed well).
Please, help me, I have to clone this file and I can't change it.
Thanks.
Attachment:
Kp1OverviewTemplate_1378cf8d.7z