Adding Chart to Word 2016 using Word Javascript Api RRS feed

  • Question

  • Hi
    I need to create and modify a chart inside a Word 2016 document using the Word JavaScript API. The Excel Api provides functions to create and modify charts, but how can I do it using the Word Api?
    I created a WordWeb add-in project using Visual Studio 2017. How can I add the Excel functions to my project to create the chart? If this is not possible, could you please point out how I could create a chart in Excel and then copy it over to the Word document (using getSelectedDataAsync and setSelectedDataAsync e.g.)
    Thanks for any help & best regars
    • Edited by Raesche123 Wednesday, March 7, 2018 1:40 PM
    Wednesday, March 7, 2018 1:39 PM

All replies

  • Hi Raesche123,

    You can try to get the get OOXML content from the Excel file and try to insert it in to Word file for the selected object.

    If you're building Office Add-ins to run in Word, you might already know that the JavaScript API for Office (Office.js) offers several formats for reading and writing document content. These are called coercion types, and they include plain text, tables, HTML, and Office Open XML.

    For more information, You can refer link below.

    Create better add-ins for Word with Office Open XML

    You can get an example from link below:




    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, March 8, 2018 7:43 AM