none
Error with getSelectedDataAsync method when coercionType is set to html RRS feed

  • Question

  • I'm creating a task pane app to work with Word. When I use the getSelectedDataAsync method with a coercion type of HTML, I get an internal error (5001) - An internal error has occurred.

                Office.context.document.getSelectedDataAsync(Office.CoercionType.Html,
                    function (result) {
                        if (result.status == Office.AsyncResultStatus.Succeeded) {
                            if (result.value == "") { app.showNotification("Please select some text.") }
                            else {}}});

    This seems to work fine when the coercion type is anything other than html. 

    I've updated my office 2013 to the latest and am using VS2013 Update 2.

    Any help would be appreciated.

    Wednesday, May 28, 2014 1:29 PM

All replies

  • Hi,

    I am trying to reproduce the issue, but failed. Could you share the more specific error message with us to trouble shoot this issue? My environment is Office 2013, Windows 8.1 and Visual Studio 2013.
    What’s your selected data type? Did you try to select text string in word document?
    Here is my steps:
    1. Create a Task Panel app in Visual Studio 2013
    2. Change the CoercionType parameter of getSelectedDataAsync function to Office.CoercionType.Html
    3. Run in debug model, when I select some text in Word document, and click “Get data from selection” button, the notifications will be pop up.

     
    BTW: what’s the version of your Apps for Office manifests schema, v1.0 or v1.1?

    #JavaScript API for Office error codes
    http://msdn.microsoft.com/en-us/library/office/dn595120(v=office.15).aspx
    Regards,
    Marvin


    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.

    Thursday, May 29, 2014 10:03 AM
  • Hi Marvin

    I've afraid I don't get any more information on the error produced. The error number is 5001 and the message reads - "An Internal Error has occurred." 

    I can reproduce this by running the steps you provided on a Windows 7 machine with all the latest updates and MS Word Version 15.0.4615.1002.

    This seems to work fine on MS Word version 15.0.4605.1000 (but I can only test this on a Windows 8.1 machine).

    I'm using v1.1 of the office schema.

    Thanks

    Ross

    Thursday, May 29, 2014 2:32 PM