nissl-lab / npoi

a .NET library that can read/write Office formats without Microsoft Office installed. No COM+, no interop.
Apache License 2.0
5.74k stars 1.43k forks source link

XSSFWorkbook object cannot be created from filestream due to system date format setting #1421

Closed Prim-Wer closed 2 months ago

Prim-Wer commented 2 months ago

NPOI Version

NPOI.2.3.0

File Type

Upload the Excel File

Should not be file related SE_Properties_Template.xlsx

Reproduce Steps

Opening Excel file with regional / date settings dd/mm/yyyy failed (English (Austria)) Changing date format to dd.mm.yyyy (German (Austria) is successfull

Issue Description

I'm trying to create a XSSFWorkbook object for an Excel .xlsx file like this using (fs = File.OpenRead(filePath)) { workbook = new XSSFWorkbook(fs); in the line new XSSFWorkbook(fs) (File exists and filestream is open) the code crashes with the error System.ArgumentException: '1 ist keine unterstützte Codepage. Parametername: codepage'

When i change the systems date settings to German (Austria) dd.mm.yyyy style the object can be created.

How can i set up the initialisation, that this works with any language / date setting?

tonyqus commented 2 months ago

.docx? Are you sure?

tonyqus commented 2 months ago

NPOI 2.3.0 is an ancient version. Can you upgrade your nuget package to the latest one and try again?

Prim-Wer commented 2 months ago

.docx? Are you sure? thank you, corrected the mistake, obviously xlsx