Get Started
Plugins
Macros
More information

GetSelectedText

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

Returns the selected text from the document.

Parameters:

Name Type Description
numbering object

The resulting string display properties.

numbering.NewLine boolean

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

numbering.NewLineParagraph boolean

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

numbering.Numbering boolean

Defines if the resulting string will include numbering or not.

numbering.Math boolean

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

numbering.TableCellSeparator string

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

numbering.TableRowSeparator string

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

numbering.ParaSeparator string

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

numbering.TabSymbol string

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

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;
        }
    }
}