Creating DropDown in Excel spread sheet From C# code

P

Prakash

Hi,
I am exporting my data to the Excel sheet using my ASP.NET
application.That is done successfully. And also while exporting I need to
add or insert DropDown list into each cell of the Excel Sheet for the
Required column. I am able to insert DropDown list into one cell using the
following code :

Microsoft.Office.Interop.Excel.

Range range = worksheet.get_Range("A3", "A3");





Microsoft.Office.Interop.Excel.

DropDowns xlDropDowns;



DropDown xlDropDown;



DropDowns)(worksheet.DropDowns(oMissing))); double)range.Left,
(double)range.Top, (double)range.Width, (double)range.Height,true);



for (int i = 0; i < ddl_item.Length; i++)





{

xlDropDown.AddItem(ddl_item, i + 1);

}

DropDown list is inserted but this not the same dropdown list as it is in
the Excel validation. How to acheive that ?
And if I select any value from dropdown then it should reflect in the
excel(means the previous value should be replaced by new selected one )

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top