Get Started
Plugins
Macros
More information

window.Asc.plugin.executeMethod ("GetSelectedText", [args], callback)

Description

Defines the method that allows getting the selected text from the document.

Usage

This method should be used in the following way:

window.Asc.plugin.executeMethod ("GetSelectedText", [numbering]);
Parameters
Parameter Description Type Example
numbering Defines the resulting string display properties:
  • NewLine - defines if the resulting string will include line boundaries or not,
    type: boolean,
    example: true;
  • NewLineParagraph - defines if the resulting string will include paragraph line boundaries or not,
    type: boolean,
    example: true;
  • Numbering - defines if the resulting string will include numbering or not,
    type: boolean,
    example: true.
  • Math - defines if the resulting string will include mathematical expressions or not,
    type: boolean,
    example: true;
  • TableCellSeparator - defines how the table cell separator will be specified in the resulting string,
    type: string,
    example: '\n';
  • TableRowSeparator - defines how the table row separator will be specified in the resulting string,
    type: string,
    example: '\n';
  • ParaSeparator - defines how the paragraph separator will be specified in the resulting string,
    type: string,
    example: '\n';
  • TabSymbol - defines how the tab will be specified in the resulting string,
    type: string,
    example: '\t'.
array of objects
Returns

The method returns the selected text in the string format.

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