in c#, rich text content saved database in below format < b>hello< /b>.
i need export ms excel sheet hello (with bold letters)
when ever try export content in excel , not showing in rich text. kindly me . thanks,
var workbook = new hssfworkbook(); var sheet = workbook.createsheet(""); int rownumber = 1; npoi.ss.usermodel.ifont font = workbook.createfont(); font.boldweight = (short)(npoi.ss.usermodel.fontboldweight.bold); font.fontheight = 210; font.fontname = "calibri"; npoi.ss.usermodel.icellstyle headercell = workbook.createcellstyle(); headercell.fillbackgroundcolor = npoi.ss.usermodel.indexedcolors.grey_25_percent.index; headercell.fillforegroundcolor = npoi.ss.usermodel.indexedcolors.grey_25_percent.index; headercell.fillpattern = npoi.ss.usermodel.fillpatterntype.solid_foreground; headercell.verticalalignment = npoi.ss.usermodel.verticalalignment.center; headercell.wraptext = true; headercell.setfont(font); headercell.borderbottom = npoi.ss.usermodel.borderstyle.thin; headercell.borderleft = npoi.ss.usermodel.borderstyle.thin; headercell.borderright = npoi.ss.usermodel.borderstyle.thin; headercell.bordertop = npoi.ss.usermodel.borderstyle.thin; npoi.ss.usermodel.ifont fontshort = workbook.createfont(); fontshort.boldweight = (short)(npoi.ss.usermodel.fontboldweight.normal); fontshort.fontname = "calibri"; npoi.ss.usermodel.icellstyle normalcell = workbook.createcellstyle(); normalcell.fillbackgroundcolor = 50; normalcell.verticalalignment = npoi.ss.usermodel.verticalalignment.center; normalcell.wraptext = true; normalcell.setfont(fontshort); normalcell.borderbottom = npoi.ss.usermodel.borderstyle.thin; normalcell.borderleft = npoi.ss.usermodel.borderstyle.thin; normalcell.borderright = npoi.ss.usermodel.borderstyle.thin; normalcell.bordertop = npoi.ss.usermodel.borderstyle.thin; npoi.ss.usermodel.icellstyle emptycell = workbook.createcellstyle(); emptycell.setfont(font); emptycell.borderbottom = npoi.ss.usermodel.borderstyle.none; emptycell.borderleft = npoi.ss.usermodel.borderstyle.none; emptycell.borderright = npoi.ss.usermodel.borderstyle.none; emptycell.bordertop = npoi.ss.usermodel.borderstyle.none; var headerrow = sheet.createrow(0); var output ="<b>helloworld</b>" var row = sheet.createrow(rownumber++); row.createcell(0).setcellvalue(output); row.cells[0].cellstyle = normalcell;
Comments
Post a Comment