c# - why NPOI created cell drop down list always split by comma -


i use npoi(the .net version of java - apache poi) created excel sheet. need add dropdown, found no matter list passed it, split item value comma, make new line. in chance, know how avoid happen? here code

cellrangeaddresslist cellrange = new cellrangeaddresslist(cell.rowindex,                          cell.rowindex, cell.columnindex, cell.columnindex); dvconstraint constraint = dvconstraint.createexplicitlistconstraint(new string[]                        {"$400","$1,900"}); hssfdatavalidation validation = new hssfdatavalidation(cellrange, constraint); validation.suppressdropdownarrow = false; sheet.addvalidationdata(validation); 

it break $1,900 2 items $1 , 900, here screenshot enter image description here

while passing values constraint pass values without comma , $ sign

dvconstraint constraint = dvconstraint.createexplicitlistconstraint(new string[]{"400","1900"}); 

and below formatting approach take care of appearance of value in dropdown

  xssfcellstyle yourcellstyle = (xssfcellstyle)workbook.createcellstyle();     xssfdataformat yourdataformat = (xssfdataformat)workbook.createdataformat();     yourcellstyle.setdataformat(yourdataformat.getformat("$#,###.00"));     sheet.setdefaultcolumnstyle(col, yourcellstyle); 

Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -