I made a template excel file as I cannot insert Header/Footer image by package.
Inside template, I create a sample sheet which has Header/Footer with images.
When I write to Excel file with package, I tried to copy that sample sheet to every new sheet.
I can add the new sheet and can write to cells, no error. But after I save the Excel file and open the file with MS Excel, it says file is corrupted.
It seems copy from existing sheet to new sheet is not working.
Even I just copy the workseet to new sheet and didn't write anything is corrupted.
ExcelPackage excel = new ExcelPackage(excelTemplate);
ExcelWorksheet sampleSheet = excel.Workbook.Worksheets["Sample"];
ExcelWorksheet ws = excel.Workbook.Worksheets.Add("Sheet1", sampleSheet);
Then I tried to write to that sample sheet. It is OK and I can read back with Excel with existing Header and Footer images.
Then I tried to insert an Image to that sample sheet. It is corrupted again.
FileInfo f = new FileInfo("D:\\Picture.png");
Any help would be appreciated.
Thanks for the good job.