EPPlus icon indicating copy to clipboard operation
EPPlus copied to clipboard

Use the Range.Copy method to report an error when there is a particular text box on the worksheet

Open minren118 opened this issue 1 year ago • 2 comments

EPPlus usage

Noncommercial use

Environment

Windows

Epplus version

7.4.1

Spreadsheet application

Excel365

Description

testcopyRange1.xlsx

Very weird behavior, as long as this text box exists on my worksheet (a new text box cannot be reproduced, I copied it from an error sheet)

image

                using (var package = new ExcelPackage("testcopyRange1.xlsx"))
                {
                    var syncSht = package.Workbook.Worksheets["syncSht"];
                    var snapSht = package.Workbook.Worksheets["snapSht"];
                    var address = "B7:B16";
                    try
                    {
                        snapSht.Cells[address].Copy(syncSht.Cells[address]);
                    }
                    catch (Exception ex)
                    {

                        throw;
                    }
                 

                   

                }

the exception stack trace below:

System.NullReferenceException HResult=0x80004003 Message=未将对象引用设置到对象的实例。 Source=EPPlus StackTrace: at OfficeOpenXml.Core.RangeCopyHelper.CopyDrawings() at OfficeOpenXml.Core.RangeCopyHelper.Copy() at OfficeOpenXml.ExcelRangeBase.Copy(ExcelRangeBase Destination) at ConsoleApp2.Program.Main(String[] args) in \Program.cs:line 54

minren118 avatar Oct 22 '24 03:10 minren118