Skip to content

System.ArgumentException when inserting columns in a worksheet #2228

@swmal

Description

@swmal

Error message: Destination array was not long enough. Check destIndex and length, and the array's lower bounds.

The Exception is thrown when the value of i is 9 in the code below.

 [TestMethod]
 public void InserWorksheetIssue()
 {
     using var pck = new ExcelPackage();
     var worksheet = pck.Workbook.Worksheets.Add("Sheet1");
     for (int i = 1; i < 10; i++)
     {
         worksheet.InsertColumn(i, 1);
     }
 }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions