XSSFHyperlink with more than 65.000 rows
See original GitHub issueI’m having some problems when I use XSSFHyperlink and the file has more than 65.000 rows. When opening the file with Excel application, Excel throws an error message reporting that the file needs to be restored. After a while the file is opened but the hyperlink address is missing.
The code I’m using to create the link is:
IRow row = hoja.CreateRow(i + 1);
row.CreateCell(col).SetCellValue(val.ToString());
XSSFHyperlink link = new XSSFHyperlink(HyperlinkType.Url);
link.Address = val.ToString();
row.Cells[col].Hyperlink = link;
What I’ve tried so far:
-
Exporting less than 65.000 rows does not throw error, although opening the file is a bit slow with a high number of rows.
-
Just in case the original link data is causing errors, I’ve checked that modifing the hiperlink address to “https://www.google.es/” throws same error with more than 65.000 rows.
-
Reducing the number of columns does not avoid the error.
Attached is an example excel file with 4 columns and more than 67.000 rows
Any help will be appreciated. Thanks in advance
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (4 by maintainers)
Top GitHub Comments
FYI Excel has a hard limit of 65530 links: https://support.microsoft.com/en-us/office/excel-specifications-and-limits-1672b34d-7043-467e-8e27-269d656771c3
To verify this, push it to the edge: https://jsfiddle.net/t6wvkzc7/ (You can fiddle with rows)
65529 rows is valid in Excel 2019: links.65529.xlsx
65531 rows is deemed corrupt: links.65531.xlsx
I already did it some weeks ago 😉