How to add a drop down (combo) box to a column in excel work sheet? RRS feed

  • General discussion

  • Hi,

    I'm using OpenXml (OfficeOpenXml.ExcelPackage)  to export a dataset to excel download.

    I'm able to do it successfully but I need to add a dropdown to a column. say, a column "Quarter" shows a value out of  'Q1, Q2, Q3, Q4'. but I need to show these values in a dropdown box with default select to none.

    Thanks for all your pointers/samples/ suggestions in advance.


    Tuesday, May 11, 2010 6:06 AM

All replies

  • Hi venkatMreddy,

    Thanks for your question.

    From your description, I guess you are using ExcelPackage, right? This is a third party effort on manipulating Open XML files, but this forum is focusing on Open XML SDK which provides developers a set of classes to easily create, consume, and manipulate Open XML files without the need for automating Office client applications.

    If you could use the Open XML SDK, I suggest you using the Productivity Tool (Which can be downloaded from the same page as the SDK), you could do the following steps:

    1.      Create a source xlsx document and save it, such as “source.xlsx”.

    2.      Add a dropdown list to the xlsx and save it as “target.xlsx”.

    3.      Open the Tool; click "Compare Files" to compare the “source.xlsx” and “target.xlsx” files.

    4.      In the "File Comparison" tab, click "View Part Diff" to show the differences between the selected two parts.

    5.       Click “View Part code” to see the complete sample code on how to add a dropdown list.

    Hope this helps. If you have any question, please let me know.



    Tuesday, May 11, 2010 6:29 AM