This project is read-only.

Convert Typed List XML SerializeToString output to Excel Document?

Jul 27, 2010 at 11:50 PM


I have picked up a project at work from a some other programmers that no longer work on the project. The project is using ASP.Net 3.5 and MVC 1.0 in C#. I have used NPOI a bit for another similar project to convert some data into an Excel document, but was wondering if it is possible to convert a typed List of datatypes to an Excel document.

Currently, the web app does something simliar to this:

string out = List<T>.SerializeToString();

The string "out" is then a long string in xml representing the data in the List<T>. When the file is saved, it's saved as a .xml file and the users are bothered that they can't quickly and easily (in one step) open the file in Excel. They have to right click and go to Open With and click a number of dialoge boxes that popup in Excel.

Is it possible to convert the "out" string (which is in xml) directly to an Excel file using NPOI?

In the other project, there was only one format for a report, so I could easily by hand make the rows and columns, but this project has three to four different reports with three to four different data types (or models to use a MVC term) and the method that creates the reports uses Generics so that it can operate on the different models and report types.

Thanks for any help you can give.