Copying a worksheet to a new workbook does not copy relevant global names
Hi, I think I've found another bug with copying worksheets (sorry).
If I copy a worksheet to a new workbook, and that worksheet contains cells that are 'global' names (i.e. names defined at the workbook level), EPPlus doesn't copy those names. This means that any formula on the worksheet that references that name will be broken on the copied sheet.
If I try the same thing in Excel, the global names on the sheet do get copied.
EPPlus don't copy workbook defined names when using a worksheet as template today. For now you will have to copy any defined name on the worksheet level yourself. To add this functionality we will have to check all formulas for references to defined names on this level. I'll add this as an enhancement for a future version.
Great, thanks.
Just to clarify, as I think there's two possible things here:
- Global Names which reference a range on the sheet being copied (e.g. if I name Sheet1!A1 as MyRange, should MyRange be copied when I copy Sheet1?)
- Formulas on the sheet which use a Global Name, where that name might be on a different sheet (e.g. if Sheet2 uses MyRange in a formula, should MyRange be copied when I copy Sheet2?)
In this issue I'm just talking about number 1 (which I think should just mean checking all the workbook's defined names?). I think number 2 could be quite slow and wouldn't be in line with what Excel does anyway.
Yes, I see your point. I'll have a look at it for a future version.