EPPlus icon indicating copy to clipboard operation
EPPlus copied to clipboard

Can not copy the sheet when the sheet has button.

Open GuangZhouDekang opened this issue 5 years ago • 2 comments

If the sheet has button. can not use copy a new sheet.

It will raise An unhandled exception of type "System.InvalidOperationException" occurred in EPPlus.dll. The Inner Exception is: Cannot access a closed Stream.

Here is my code.

private void button1_Click(object sender, EventArgs e) { FileInfo templateFile = new FileInfo("Original-With-Button.xlsx"); FileInfo newFile = new FileInfo("Copy-With-Button.xlsx"); using (var package = new ExcelPackage(newFile, templateFile)) { package.Workbook.Worksheets.Copy("Sheet1", "Sheet2");
package.Save(); } }

If I remove the button in Sheet1, the copy it work right. How can I copy the sheet with button?

GuangZhouDekang avatar Dec 07 '19 15:12 GuangZhouDekang

I have the same problem, did you solve it?

JulioSierra-MaxiMS avatar Dec 13 '19 15:12 JulioSierra-MaxiMS

no. It still has problem.

GuangZhouDekang avatar Dec 13 '19 15:12 GuangZhouDekang