Skip to content

Opening xlsx file with notes or comments throws an exception - System.ArgumentOutOfRangeException with message: Length cannot be less than zero. (Parameter 'length') #2488

@TheMonolithDestroyer

Description

@TheMonolithDestroyer

Do you want to request a feature or report a bug?

  • Bug
  • Feature
  • Question

Did you test against the latest CI build?

  • Yes
  • No

Version of ClosedXML

e.g. 0.104.1 nuget package

What is the current behavior?

I have an Excel file with notes or comments in it. When I try to open a spreadsheet it throw an exception 'Length cannot be less than zero. (Parameter 'length')'. The error is related to the definition of internal margins of the text box. The XML structure has a textbox attribute, and it has an inset attribute with the value inset="2.16pt,1.44pt, 0, 0".

What is the expected behavior or new feature?

The excel should open without throwing an exception

Is this a regression from the previous version?

no

Reproducibility

Excel file: file.xlsx

Code to reproduce problem:

using ClosedXML.Excel;

public static void Main(string[] args)
{
    using var wb = new XLWorkbook("file.xlsx");
}
  • I attached a sample spreadsheet. (You can drag files on to this issue)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions