This project has moved. For the latest updates, please go here.

"Friend access was granted" compilation error

Apr 27, 2015 at 8:41 AM
Hi there,

I started using EPPlus and everything went fine until I tried to use the Copy method of the ExcelRange class like that:
var worksheet = package.Workbook.Worksheets.FirstOrDefault();
var cell = worksheet.Cells["A1"];
cell.Copy(new ExcelRangeBase(worksheet, "A2"));
From the moment I had the last line, the compilation fails with the dreaded "Friend access was granted..." error. I googled that without any success. Any help appreciated!

Cheers,
Thomas
Apr 29, 2015 at 6:29 AM
Well I figured out that it was the call to the ExcelRangeBase ctor that raised the issue, because
cell.Copy(worksheet.Cells["A2"]);
works fine... Don't know why it popped such a weird compilation error.

Now on another topic, I was wondering if it is possible to copy a cell together with its conditional formatting. Any hints?

Cheers,
Thomas