Skip to content
This repository has been archived by the owner on Mar 9, 2020. It is now read-only.

Can not copy the sheet when the sheet has button. #591

Open
GuangZhouDekang opened this issue Dec 7, 2019 · 2 comments
Open

Can not copy the sheet when the sheet has button. #591

GuangZhouDekang opened this issue Dec 7, 2019 · 2 comments

Comments

@GuangZhouDekang
Copy link

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?

@JulioSierra-MaxiMS
Copy link

I have the same problem, did you solve it?

@GuangZhouDekang
Copy link
Author

no. It still has problem.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants