locked
How to Convert Excel to XML in task pane using JavaScript API RRS feed

  • Question

  • As we know, We can convert excel to XML file, but now I want to convert excel to xml by using JavaScript API in task pane app, Can anyone help me and give me some code snippet. Thanks a lot
    Friday, November 22, 2013 8:30 AM

Answers

  • Hi.

    Welcome to MSDN forum.

    Saving an Excel workbook as an XML file is a feature of Excel, we can use Workbook.SaveAs Method by Excel Object Model.

    However, in Excel task pane app(apps for Office), there are only several objects can be used such as Context Object, Document object and there is no such function in these objects to export a workbook as an XML file. For more information, please refer to these articles:

    Understanding the JavaScript API for Office

    Fundamentals for developing task pane and content apps

    I provide a workaround for your reference.

    1.        Select the whole worksheet then get data using Document.getSelectedDataAsync method (there is a sample in the article)
    2.        Dynamically generate an XML file using JavaScript.

    To generate an XML file using JavaScript, there are many resource talking about it when you research by Bing. Also, you could get support from ASP.NET HTML, CSS and JavaScript forum.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by George Hua Tuesday, December 3, 2013 2:44 AM
    Monday, November 25, 2013 3:40 PM