Corrupted Excel files with NPOI -

Feb 22, 2014 at 5:50 PM
Edited Feb 22, 2014 at 5:51 PM
Hi all, I need a small help with NPOI and
I'm trying to create an excel file from a web application, written in (vb).
Everything is fine with excel 2003 xls format, while using the XSSF object model I get corrupted files.
Opening files in Excel I get the message that says file is corrupted, and can be restored (and actually Excel repairs it). The problem occurs even if I try to save stream into a file, rather than using memorystream.
Help is appreciated...
Here's the code:
 Dim wb As New XSSFWorkbook
    Dim ws As new XSSFSheet
    ws = wb.CreateSheet("Sheet1")
    Dim r As XSSFRow
    r = ws.CreateRow(0)
    Dim c = r.CreateCell(0)

    Dim m As New IO.MemoryStream

    Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
    Response.AddHeader("content-disposition", "attachment;filename=test.xlsx")