Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when editing a file that has a table name with null value #410

Closed
2 of 3 tasks
vmrocha opened this issue Jul 18, 2017 · 1 comment
Closed
2 of 3 tasks

Error when editing a file that has a table name with null value #410

vmrocha opened this issue Jul 18, 2017 · 1 comment
Milestone

Comments

@vmrocha
Copy link

vmrocha commented Jul 18, 2017

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

  • Bug
  • Feature

Version of ClosedXML

e.g. 0.87.1

What is the current behavior?

If I try to load as XLSX file that has a table and the table has the name value equals to null, it will throw an exception.

Result StackTrace:	
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at ClosedXML.Excel.XLTables.Add(IXLTable table) in C:\Users\Vinicius\Documents\GitHub\ClosedXML\ClosedXML\Excel\Tables\XLTables.cs:line 27
   at ClosedXML.Excel.XLTable.AddToTables(XLRange range, Boolean addToTables) in C:\Users\Vinicius\Documents\GitHub\ClosedXML\ClosedXML\Excel\Tables\XLTable.cs:line 403
   at ClosedXML.Excel.XLTable..ctor(XLRange range, String name, Boolean addToTables, Boolean setAutofilter) in C:\Users\Vinicius\Documents\GitHub\ClosedXML\ClosedXML\Excel\Tables\XLTable.cs:line 45
   at ClosedXML.Excel.XLRange.CreateTable(String name, Boolean setAutofilter) in C:\Users\Vinicius\Documents\GitHub\ClosedXML\ClosedXML\Excel\Ranges\XLRange.cs:line 293
   at ClosedXML.Excel.XLWorkbook.LoadSpreadsheetDocument(SpreadsheetDocument dSpreadsheet) in C:\Users\Vinicius\Documents\GitHub\ClosedXML\ClosedXML\Excel\XLWorkbook_Load.cs:line 272
   at ClosedXML.Excel.XLWorkbook.LoadSheets(Stream stream) in C:\Users\Vinicius\Documents\GitHub\ClosedXML\ClosedXML\Excel\XLWorkbook_Load.cs:line 55
   at ClosedXML_Tests.Excel.LoadingTests.CanLoadAndManipulateTableWithNameNull() in C:\Users\Vinicius\Documents\GitHub\ClosedXML\ClosedXML_Tests\Excel\Loading\LoadingTests.cs:line 186
Result Message:	
System.ArgumentNullException : Value cannot be null.
Parameter name: key

What is the expected behavior or new feature?

I should be able to open and manipulate the table with no error messages.

Did this work in previous versions of our tool? Which versions?

I don't think so.

  • I attached a sample spreadsheet. (You can drag files on to this issue)

TableWithNameNull.xlsx

Code to reproduce problem:

public void Main()
{
    var filePath = "...";
    using (var wb = new XLWorkbook(filePath))
    {
        var ws = wb.Worksheets.First();
        var table = ws.Tables.First();
        table.DataRange.InsertRowsBelow(5);
    }
}
@igitur
Copy link
Member

igitur commented Aug 23, 2017

ClosedXML v0.89.0-beta1 has been published and is ready for your testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants