locked
Convert Xml Spreadsheet 2003 (*.xml) to XML spreadsheet into Xls or Xlsx File RRS feed

  • Question

  • Hi

    How to convert Xml Spreadsheet 2003 (*.xml) to XML spreadsheet into Xls or Xlsx File in C# on MVC web site. I have tried the following ways:

    1. Used Interop.excel but couldn't execute on production environment.

    2. Renaming spreadsheet to xls file.

    3. Used Open XML SDK. Couldn't find any methods to convert it.

    Thanks in advance..

    Anu

    Sunday, January 19, 2014 4:15 PM

Answers

  • Hello,

       You can try using this solution,
       http://spreadsheet.codeplex.com/

      
    Workbook workbook = new Workbook(); 
    workbook.LoadFromFile(@"..\..\test.xml"); 
    workbook.SaveToFile("sample.xlsx", ExcelVersion.Version2010);

    -----------------------------------------
     Mark as answer if it helps to you
     Free .NET Barcode Generator & Scanner supporting over 40 kinds of 1D & 2D symbologies.

      
    • Proposed as answer by Fei XueMicrosoft employee Monday, January 20, 2014 2:42 AM
    • Marked as answer by Anu_Dev Monday, January 20, 2014 4:01 AM
    • Unmarked as answer by Anu_Dev Monday, January 20, 2014 4:20 AM
    • Marked as answer by Anu_Dev Monday, January 20, 2014 4:20 AM
    Monday, January 20, 2014 2:07 AM

All replies

  • Well, they are the same thing, the only difference is how the file is displayed to the end user, right.  Try this method.

    http://stackoverflow.com/questions/16160804/how-to-convert-xml-to-excel-sheet-of-same-name-using-c-net

    Does that work got you?


    Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.

    Sunday, January 19, 2014 11:14 PM
  • Above Post of stack Overflow  seems to be Simply Creating XLSX File using XML Data. I have XML Spreadsheet Which is a Excel File which looks fine when opened in Ms Excel. Its format is .xml but its a spreadsheet excel file. I need to convert that to .xlsx  2007 format. Its a requirement of end User.

    XML Spreadsheet  looks like-

    <?xml version="1.0" encoding="utf-8"?><Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:html=http://www.w3.org/TR/REC-html40 xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"><Styles><Style ss:ID="Default" ss:Name="Normal"><Alignment ss:Vertical="Bottom" /><Borders /><Font ss:FontName="Calibri" x:Family="Swiss" ss:Size="11" ss:Color="#000000" /><Interior /><NumberFormat /><Protection /></Style></Styles> ....

    This is just a header , its is created using XSLT.

    Monday, January 20, 2014 12:11 AM
  • Hello,

       You can try using this solution,
       http://spreadsheet.codeplex.com/

      
    Workbook workbook = new Workbook(); 
    workbook.LoadFromFile(@"..\..\test.xml"); 
    workbook.SaveToFile("sample.xlsx", ExcelVersion.Version2010);

    -----------------------------------------
     Mark as answer if it helps to you
     Free .NET Barcode Generator & Scanner supporting over 40 kinds of 1D & 2D symbologies.

      
    • Proposed as answer by Fei XueMicrosoft employee Monday, January 20, 2014 2:42 AM
    • Marked as answer by Anu_Dev Monday, January 20, 2014 4:01 AM
    • Unmarked as answer by Anu_Dev Monday, January 20, 2014 4:20 AM
    • Marked as answer by Anu_Dev Monday, January 20, 2014 4:20 AM
    Monday, January 20, 2014 2:07 AM
  • Yeah that's awesome!!! But After generating Xlsx It add extra sheet saying its a evaluation Version. Its not free??
    Monday, January 20, 2014 4:01 AM
  • There is a free edition. Please use the free edition from Spire.xls LIBRARY from the website.

    Thanks

    Shri

    Thursday, May 5, 2016 6:25 PM