NPOI Version
2.7.1
File Type
Upload the Excel File
EmptyFormatCode.xlsx
Reproduce Steps
Just open and save the file with NPOI, sample code written in .NET 6:
using NPOI.XSSF.UserModel;
string path = "EmptyFormatCode.xlsx";
XSSFWorkbook workbook;
using (FileStream file = new(path, FileMode.Open, FileAccess.Read))
{
workbook = new(file);
file.Close();
}
using (FileStream file = new(path, FileMode.Truncate, FileAccess.Write))
{
workbook.Write(file);
file.Close();
}
workbook.Close();
Issue Description
When the formatCode attribute value of the numFmt tag in /xl/styles.xml in the workbook archive is an empty string "", NPOI will treat it as a null value and generate the following form xml:
The current version of Excel does not seem to accept a formatCode value of null and prompts the following error:


NPOI Version
2.7.1
File Type
Upload the Excel File
EmptyFormatCode.xlsx
Reproduce Steps
Just open and save the file with NPOI, sample code written in .NET 6:
Issue Description
When the
formatCodeattribute value of thenumFmttag in/xl/styles.xmlin the workbook archive is an empty string"", NPOI will treat it as anullvalue and generate the following form xml:The current version of Excel does not seem to accept a
formatCodevalue of null and prompts the following error: