NPOI makes a mess of my .XLSX file when writing to existing file

Jun 23, 2013 at 8:54 PM
Hi folks,

When I wrtie to an .XLS file there is no problem, it works correct. But when I write to a .XLSX file the file is messed up. Mu code is ±

private IWorkbook wb;

// Class and code
                FileStream file = new FileStream(bestand, FileMode.Open, FileAccess.Read);

                string ext = Path.GetExtension(bestand).ToLower();

                if (ext == ".xls")
                    wb = new HSSFWorkbook(file);
                else if (ext == ".xlsx")
                    wb = new XSSFWorkbook(file);

                ISheet ws = wb.GetSheet(Maanden[maand-1]); // The month sheet


It this the way to write? to an .XLSX file.

Regards rinaldo