Search code examples
c#asp.netexcelexport-to-excel

Export/import to Excel with combo box


I'm still struggling with my scenario. I have looked everywhere for a solution and cannot find a solution. I am using C# and ASP.NET and I need to export data to an Excel spreadsheet.

I have a list of applications that contains Application objects. Each Application object has a status ID. When I export these applications to Excel then I need a column with a drop down/combo box in it. In this drop down/combo box should be a list of all the statuses from the database. And then I need the status to be selected to that of the application's status ID.

Another question is also with regards to the above scenario. When the user downloads the Excel document then the user can change the status of each application by selecting a different value in the drop down. I will need to upload this spreadsheet and loop through the rows and get the values of the columns and the value of the selected item in the drop down/combo box. How would you do this? Is this possible?

I may not use COM components, so I tried to go with EPPlus or NPOI (it does not have to be these 2) but it doesn't seem like they support my scenario. How would I be able to achieve my scenario? Once again, it doesn't have to make use of EPPlus and NPOI. Working examples would be appreciated :)

Thanks

Brendan


Solution

  • Have you tried using a template in NPOI? When I want to export complex spreasheets with NPOI, I create a XLS document to use as a template, and fill in the data via C#.