none
Using OOXML in Word 2013 task pane app RRS feed

  • Question

  • I'm looking calling the Office.context.document.setSelectedDataAsync function using the "ooxml" coercionType. Is there an example of this functionality available?

    Tuesday, September 18, 2012 11:31 AM

Answers

  • Hi stbutler,

    OOXML code samples are in the works and will be published in the future. In the meantime, if you are unfamiliar with OOXML you can check out the following sites to learn more:

    http://www.ecma-international.org/publications/standards/Ecma-376.htm
    http://blogs.msdn.com/b/brian_jones/archive/2010/04/06/zeyad-rajabi-s-open-xml-sdk-blog-map.asp
    http://openxmldeveloper.org/

    Additionally, you can inspect the OOXML representation of various data types in Word, directly through an app for Office. Try doing something like the following:

    function getData(elementId) {
        Office.context.document.getSelectedDataAsync(Office.CoercionType.Ooxml,
        function (result) {
            if (result.status == "succeeded") {
                document.getElementById(elementId).value = result.value;
            }
        });
    }

    The above function gets the selected data using coercion type OOXML, and writes the data into text element on the app HTML page. You can try inserting text, images, shapes, tables, etc. with your own custom formatting and use the above function to inspect the OOXML representation of that data. You can save that data to a variable, and write it back into the document; you should notice that using OOXML gives a full fidelity transfer of data, which is a great advantage over other coercion types! Hopefully you can give these alternatives a try for now.

    Regards,
    Gareth

    • Marked as answer by stbutler Wednesday, September 19, 2012 8:24 AM
    Tuesday, September 18, 2012 6:57 PM
    Moderator