Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have a web application that reads from XML, but the users need to upload .xlsx or .xls files.

How do I programatically convert the Excel files into XML spreadsheet 2003?

share|improve this question

2 Answers

I suggest you take a look at a similar question here on stackoverflow. The following alternatives are mentioned (among others):

  • NPOI which is free and open source
  • Aspose, in your case Apose.Cells, although it is definitely not free

I have no experience with either of these.

Using Microsoft Office Interop assemblies is not an option - it just won't work:

Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.

share|improve this answer

You can read an existing excel file and save it into required format: xlXMLSpreadsheet.

Below is the sample code:

Microsoft.Office.Interop.Excel.Application app = 
    new Microsoft.Office.Interop.Excel.Application();
Workbook wb = app.Workbooks.Open("D:\\sample.xlsx");
wb.SaveAs("D:\\sample.xml", FileFormat: Microsoft.Office.Interop.Excel.XlFileFormat.xlXMLSpreadsheet);
wb.Close();
app.Quit();
share|improve this answer
-1 Using Office interop assemblies on a web server is a really bad idea. See support.microsoft.com/default.aspx?scid=kb;EN-US;q257757 – mbjdev Jun 7 at 12:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.