EPPlus icon indicating copy to clipboard operation
EPPlus copied to clipboard

Issue with copying worksheets to another workbook, something about Excel Tables

Open nmanring opened this issue 9 months ago • 2 comments

EPPlus usage

Commercial use (I have a commercial license)

Environment

Windows

Epplus version

7.1.2

Spreadsheet application

Excel

Description

I am writing code that will merge multiple excel files into one workbook. There is an issue that I have narrowed down to be something related to an excel table being part of the worksheet causing a problem. I'm attaching my start file and the result produced. The result produced will give you an error if you open in excel and after continuing all styling is lost. I am not doing anything special in code, just creating a new excelpackage and then opening an existing excelpackage and copying all worksheets to the new package (also making sure to guarantee unique worksheet names). The specific copy method I use is oPackage.Workbook.Worksheets.Add(newName, wksht); where wksht is the worksheet form the excelpackage i am copying from, and oPackage is the new excelpackage I have created.

If in my workbook I convert the excel table to a range and try again, the error goes away and it works correctly. This leads me to believe it is something to do with the table but not sure what specifically is the issue and if it can be addressed.

Let me know if you need any more information, Thank you

tabletest3.xlsx tabletest3output.xlsx

nmanring avatar May 20 '24 20:05 nmanring