Quantcast
Channel: NPOI
Viewing all articles
Browse latest Browse all 1621

Commented Unassigned: XSSFWorkbook is corrupt when CurrentThread.CurrentCulture uses a comma instead of a period as the decimal separator [13252]

$
0
0
```c#
IWorkbook workbook;
ISheet sheet;

Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
workbook = new XSSFWorkbook();
sheet = workbook.CreateSheet();
using (var stream = new FileStream("en-US.xlsx", FileMode.Create))
{
workbook.Write(stream);
}

Thread.CurrentThread.CurrentCulture = new CultureInfo("nl-BE");
workbook = new XSSFWorkbook();
sheet = workbook.CreateSheet();
using (var stream = new FileStream("nl-BE.xlsx", FileMode.Create))
{
workbook.Write(stream);
}
```

__en-US.xlsx__ will open fine, __nl-BE.xlsx__ will be corrupt (although repairable). When unzipping both files and running a diff, there's only one difference and it's in __xl\worksheets\sheet1.xml__

__en-US.xlsx__
```xml
<pageMargins left="0.7" right="0.7" top="0.75" bottom="0.75" header="0.3" footer="0.3"></pageMargins>
```

__nl-BE.xlsx__
```xml
<pageMargins left="0,7" right="0,7" top="0,75" bottom="0,75" header="0,3" footer="0,3"></pageMargins>
```

As you can see, it's the decimal separator.
Comments: ** Comment from web user: tonyqus **

which version are you using? I remember this issue is fixed. Please try the latest version 2.1.3


Viewing all articles
Browse latest Browse all 1621

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>