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

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

android - ConstraintLayout: Realign baseline constraint in case if dependent view visibility was set to GONE -

c# - Populating Gridview inside Listview ItemTemplate On Web User Control from Code Behind -