c# - How would I go about converting NPOI.SS to NPOI.XSSF? -
i'm attempting replace need utilize excel interop libraries moving npoi. hitting bit of snag @ moment next code:
xssfsheet sheetname = excelworkbook.getsheet(sheet); system.collections.ienumerator rows = sheetname.getrowenumerator(); while (rows.movenext()) { xssfrow row = (xssfrow)rows.current; foreach (xssfcell cell in row.cells) { cellcontent = cell.stringcellvalue; } }
the error receiving is:
cannot implicitly convert type 'npoi.ss.usermodel.isheet' 'npoi.xssf.usermodel.xssfsheet'. explicit conversion exists (are missing cast?)
where going wrong? haven't references hssf.
note: i've made more mistakes this, point them out me if notice anything.
the getsheet method returns type isheet, not xssfsheet.
so, need alter
xssfsheet sheetname = excelworkbook.getsheet(sheet);
to
xssfsheet sheetname = (xssfsheet)excelworkbook.getsheet(sheet);
explicitly casting isheet xssfsheet
c# npoi
No comments:
Post a Comment