Return selected text with styling and formatted RRS feed

  • Question

  • Hello,

    I created an Add-In App for Office365 (Word, Excel and Powerpoint) and i want to get the selected text inside my app, with new lines and styling.

    I am using the following code to do that

    function getSelectedData(hasSelectionCallback, noSelectionCallback) {
    var type = Office.CoercionType.Text;
    valueFormat: "formatted", filterType: "all"
    function (asyncResult) {
    var error = asyncResult.error;
    if (asyncResult.status === Office.AsyncResultStatus.Failed)
    console.log( + ": " + error.message);
    else {
    // Get selected data.
    var dataValue = asyncResult.value;
    else {
    selectedData = null;

    I tried with all types of Coercion but none does what i actually need.

    For example, i want to parse the selected data, so i can know where the new lines are.

    For the moment it only returns plain text, with no formatting or styling.

    I would appreciate a response for my problem.

    Thank you!

    Tuesday, April 19, 2016 7:06 AM