Quantcast
Channel: npoi Discussions Rss Feed
Viewing all articles
Browse latest Browse all 637

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

$
0
0
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

                ws.GetRow(colum).GetCell(rij++).SetCellValue(huidigedatum);
                                ws.GetRow(colum).GetCell(rij++).SetCellValue(Datarow["Factuurnummer"].ToString());
                                ws.GetRow(colum).GetCell(rij++).SetCellValue(Datarow["Omschrijving"].ToString());

                                ws.GetRow(colum++).GetCell(tbBank-1).SetCellValue((double)totaal);
It this the way to write? to an .XLSX file.

Regards rinaldo

Viewing all articles
Browse latest Browse all 637

Trending Articles



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