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

XSSFTable SetCellReferences() fails with exception if the referenced area is not empty #1026

Closed
superrnovae opened this issue Feb 25, 2023 · 0 comments · Fixed by #1035
Closed

Comments

@superrnovae
Copy link
Contributor

superrnovae commented Feb 25, 2023

Can be reproduced with this example if you fill the sheet with data and then try to add the table on top of filled data.

It does not happen if we first create the table, then populate cells with data, then update the tables referenced area to match the contents.

It also does not happen when the table is created with CT_Table.

Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.   
at NPOI.XSSF.UserModel.XSSFTable.UpdateHeaders()   
at NPOI.XSSF.UserModel.XSSFTable.SetCellRef(AreaReference refs)   
at NPOI.XSSF.UserModel.XSSFTable.SetCellReferences(AreaReference refs)   
at CreateTableInXlsx.Program.Main(String[] args) 

Update:
Here's the exact place it fails:
image

@superrnovae superrnovae changed the title XSSFTable SetCellReferences() throws an exception if AreaReference contains data. XSSFTable SetCellReferences() fails with exception if AreaReference contains data. Feb 25, 2023
@superrnovae superrnovae changed the title XSSFTable SetCellReferences() fails with exception if AreaReference contains data. XSSFTable SetCellReferences() fails with exception if the sheet is not empty Feb 25, 2023
@superrnovae superrnovae changed the title XSSFTable SetCellReferences() fails with exception if the sheet is not empty XSSFTable SetCellReferences() fails with exception if the referenced area is not empty Feb 26, 2023
@tonyqus tonyqus added this to the NPOI 2.6.1 milestone Feb 26, 2023
@tonyqus tonyqus added the xlsx label Feb 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants