A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developers.google.com/apps-script/reference/document/range-element below:

Class RangeElement | Apps Script

Class RangeElement

Stay organized with collections Save and categorize content based on your preferences.

RangeElement

A wrapper around an Element with a possible start and end offset. These offsets allow a range of characters within a Text element to be represented in search results, document selections, and named ranges.

Methods Method Return type Brief description getElement() Element Gets the Element that corresponds to this RangeElement. getEndOffsetInclusive() Integer Gets the position of the end of a partial range within the range element. getStartOffset() Integer Gets the position of the start of a partial range within the range element. isPartial() Boolean Determines whether this range element covers the entire element or a partial selection of the element's characters. Detailed documentation getElement()

Gets the Element that corresponds to this RangeElement.

const rangeElement = DocumentApp.getActiveDocument().getSelection().getRangeElements()[0];

// Log debug information about a range element.
Logger.log(`Element type: ${rangeElement.getElement().getType()}`);
if (rangeElement.isPartial()) {
  Logger.log(`The character range begins at ${rangeElement.getStartOffset()}`);
  Logger.log(
      `The character range ends at ${rangeElement.getEndOffsetInclusive()}`,
  );
} else {
  Logger.log('The entire range element is included.');
}
Return

Element — the element that corresponds to this RangeElement

Scripts that use this method require authorization with one or more of the following scopes:

getEndOffsetInclusive()

Gets the position of the end of a partial range within the range element. If the element is a Text element and isPartial() returns true, the offset is the number of characters before the last character in the range (that is, the index of the last character in the range); in any other case, this method returns -1.

Return

Integer — for Text elements, the number of character before the last character in the range; for other elements, -1

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

getStartOffset()

Gets the position of the start of a partial range within the range element. If the element is a Text element and isPartial() returns true, the offset is the number of characters before the start of the range (that is, the index of the first character in the range); in any other case, this method returns -1.

Return

Integer — for Text elements, the number of characters before the start of the range; for other elements, -1

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

isPartial()

Determines whether this range element covers the entire element or a partial selection of the element's characters. The beginning and end of a partial range element's range can be determined using getStartOffset() and getEndOffsetInclusive(), respectively.

Return

Booleantrue if the element is partially included; false if not

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2024-12-02 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-12-02 UTC."],[[["`RangeElement` is a wrapper around an `Element` that can represent a range of characters within a `Text` element."],["It is used in search results, document selections, and named ranges, allowing for partial or full element selection."],["You can get the corresponding `Element`, determine if the range is partial, and find the start and end positions of partial ranges using its methods."],["`RangeElement` methods require authorization with specific scopes, like `https://www.googleapis.com/auth/documents`."]]],[]]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4