GetSelectedText

GetSelectedText(prop, prop.NewLine, prop.NewLineParagraph, prop.Numbering, prop.Math, prop.TableCellSeparator, prop.TableRowSeparator, prop.ParaSeparator, prop.TabSymbol, prop.NewLineSeparator) → { string }

Returns the selected text from the document.

Parameters:

Name Type Description
prop object

The resulting string display properties.

prop.NewLine boolean

Defines if the resulting string will include line boundaries or not (they will be replaced with '\r').

prop.NewLineParagraph boolean

Defines if the resulting string will include paragraph line boundaries or not.

prop.Numbering boolean

Defines if the resulting string will include numbering or not.

prop.Math boolean

Defines if the resulting string will include mathematical expressions or not.

prop.TableCellSeparator string

Defines how the table cell separator will be specified in the resulting string.

prop.TableRowSeparator string

Defines how the table row separator will be specified in the resulting string.

prop.ParaSeparator string

Defines how the paragraph separator will be specified in the resulting string.

prop.TabSymbol string

Defines how the tab will be specified in the resulting string.

prop.NewLineSeparator string

Defines how the line separator will be specified in the resulting string (this property has the priority over NewLine).

Returns:

Type
string

Example

Copy code
function CorrectText () {
    switch (window.Asc.plugin.info.editorType) {
        case 'word':
        case 'slide': {
            window.Asc.plugin.executeMethod ("GetSelectedText", [{"Numbering": false, "Math": false, "TableCellSeparator": '\n', "ParaSeparator": '\n', "TabSymbol": String.fromCharCode(9)}], function (data) {
                sText = data;
                ExecTypograf (sText);
            });
            break;
        }
        case 'cell': {
            window.Asc.plugin.executeMethod ("GetSelectedText", [{"Numbering": false, "Math": false, "TableCellSeparator": '\n', "ParaSeparator": '\n', "TabSymbol": String.fromCharCode(9)}], function (data) {
                if (data == '') {
                    sText = sText.replace (/\t/g, '\n');
                    ExecTypograf (sText);
                }
                else {
                    sText = data;
                    ExecTypograf (sText);
                }
            });
            break;
        }
    }
}