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

Commented Unassigned: Incorrect generated XLSX file [13926]

$
0
0
Hello...

I have NPOI 2.2.1 and I realized that when generating XLSX file and opening with Excel 2013, a message box telling that a problem was encountered but Excel could try to recover from it. When I click "Yes", the sheet is finally shown.

This is the code:

```
IWorkbook workbook = new XSSFWorkbook();
ISheet sheet = workbook.CreateSheet(this.Title);

using (var exportData = new MemoryStream())
{
workbook.Write(exportData);
return exportData.GetBuffer();
}

```

As you see, I am only creating the workbook, adding a sheet and then returning the bytes array. That array is stored in file using this code:

```
string targetFile = System.IO.Path.Combine(System.IO.Path.GetTempPath(), String.Concat(btnExportar.Tag, "_", DateTime.Now.ToString("yyyyMMddHHmmss"), ".xlsx"));
System.IO.File.WriteAllBytes(targetFile, xls.GetExcelData());

```

With XLS files there is no problem.

Regards
Jaime
Comments: ** Comment from web user: tonyqus **

Please contact me via support@neuzilla.com and send me the Excel file. Something wrong in the core properties serializaiton.


Viewing all articles
Browse latest Browse all 1621

Trending Articles



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