ShowDropdown in one of the cells

Aug 24, 2012 at 6:45 PM

I have a requirement to show dropdown values in one of the cell columns(Lost-Yes/No/NotSure)

 

How do I make the sheet for the user to pick values in it if I am using closed xml to generate it?

Any suggestions would be appreciated.

Aug 24, 2012 at 7:35 PM

Got it ....Missed the DataValidation class

  // From a list               

ws.Cell("D1").Value = "Yes";               

ws.Cell("D2").Value = "No";               

ws.Cell("A5").SetDataValidation().List(ws.Range("D1:D2"));

Coordinator
Aug 24, 2012 at 7:39 PM

You can also pass a string with the range address:

ws.FirstCell().SetValue("Yes")
  .CellBelow().SetValue("No")
  .CellBelow().SetValue("Not Sure")
  .CellBelow().DataValidation.List("A1:A3");