none
Office Add-ins , How I can insert text at a specific position by row and column? Office Word JavaScript RRS feed

  • Question

  • How I can insert text at a specific position by row and column in office word? with javaScript. Can I set parameters for a binding function and then set the given text at at a specific position in document? 

    Thank you,

    Sami

    Thursday, August 6, 2015 9:15 PM

Answers

  • Hi Sami,

    Did you want to insert the text into the specific row and column in a table? If I understood correctly, we can pass the '' and 'startColumn' to achieve the goal.

    Here is an sample to insert into the text into 3rd row and 2nd column for your reference:

     Office.context.document.bindings.getByIdAsync("table1", function (asyncResult) {
                if (asyncResult.status == "succeeded") {
    
                    var myTable = new Office.TableData();
                    //myTable.headers=['LastName']
                    myTable.rows = ['Hao']
                    asyncResult.value.setDataAsync(myTable, { startRow: 1 , startColumn: 1 }, function (asyncResult) {
                        write(asyncResult.status);
                    });
                }
            })

    You can get more detail about this methoed from link below:
    Binding.setDataAsync method

    Regards & Fei


    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.

    Monday, August 10, 2015 5:49 AM
    Moderator