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

Bug: ExcelRangeBase.Copy with a $ reference leads to #REF if non-$ would be out of bounds #554

Open
Naryoril opened this issue Sep 24, 2019 · 0 comments

Comments

@Naryoril
Copy link

EPPlus 4.5.3.2 - .NET Core 2.1 and EPPlus 4.5.3.1 - .NET Framework 4.5.2

If you reference another cell, for example =$A$1, or have a formula with such references, for example =SUM($A$1:$A$5), and then copy the cell with your formula so that the reference without the $ would be out of the bounds of the Excel sheet by at least 2, the formula in the copied cell will be #REF. So if you have the simple formula =$A$1 in cell B3 and then you call worksheet.Cells["B3"].Copy(worksheet.Cells["B2"]); everything is fine and in B2 the formula will be =$A$1, but if you call worksheet.Cells["B3"].Copy(worksheet.Cells["B1"]);, the content of B1 will simply be #REF.

The attackment contains a full VS project showing the issue. The used template file also shows the results if you copy through Excel directly.

FormulaCopyOutOfRange.zip

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

1 participant