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?
I suggest you take a look at a similar question here on stackoverflow. The following alternatives are mentioned (among others):
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.
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();