Skip to main content

GetSelectedContent

Returns the selected content in the specified format.

Syntax

expression.GetSelectedContent(prop);

expression - A variable that represents a Api class.

Parameters

NameRequired/OptionalData typeDefaultDescription
propRequiredobjectThe returned content properties.
prop.typeOptional"text" | "html""text"The format type of the returned content (text or HTML).

Returns

string

Example

const prepareShape = function () {
const doc = Api.GetDocument();

const text = 'Text string to select from.';
const paragraph = doc.GetElement(0);
paragraph.AddText(text);

const range = paragraph.GetRange(6, 12);
range.Select();
};

Asc.plugin.callCommand(prepareShape);
Asc.plugin.executeMethod('GetSelectedContent', [], console.log);