### Method

# Atspi Text get_string_at_offset

since: 2.9.90

#### Declaration [src]

    AtspiTextRange*
    atspi_text_get_string_at_offset (
      AtspiText* obj,
      gint offset,
      AtspiTextGranularity granularity,
      GError** error
    )

#### Description [src]

Gets a portion of the text exposed through an `AtspiText` according to a given `offset` and a specific `granularity`, along with the start and end offsets defining the boundaries of such a portion of text.

If `granularity` is ATSPI_TEXT_GRANULARITY_CHAR the character at the offset is returned.

If `granularity` is ATSPI_TEXT_GRANULARITY_WORD the returned string is from the word start at or before the offset to the word start after the offset.

The returned string will contain the word at the offset if the offset is inside a word and will contain the word before the offset if the offset is not inside a word.

If `granularity` is ATSPI_TEXT_GRANULARITY_SENTENCE the returned string is from the sentence start at or before the offset to the sentence start after the offset.

The returned string will contain the sentence at the offset if the offset is inside a sentence and will contain the sentence before the offset if the offset is not inside a sentence.

If `granularity` is ATSPI_TEXT_GRANULARITY_LINE the returned string is from the line start at or before the offset to the line start after the offset.

If `granularity` is ATSPI_TEXT_GRANULARITY_PARAGRAPH the returned string is from the start of the paragraph at or before the offset to the start of the following paragraph after the offset.

Available since: 2.9.90

#### Parameters

`offset`

  Type: `gint`

  Position.

`granularity`

  Type: `AtspiTextGranularity`

  An `AtspiTextGranularity`.

`error`

  Type: `GError **`

  The return location for a recoverable error.

  The argument can be `NULL`.
  If the return location is not `NULL`, then you must initialize it to a `NULL` `GError*`.
  The argument will be left initialized to `NULL` by the method if there are no errors.
  In case of error, the argument will be set to a newly allocated `GError`; the caller will take ownership of the data, and be responsible for freeing it.

#### Return value

Type: `AtspiTextRange`

A newly allocated string containing the text at the `offset` bounded by the specified `granularity`. Use `g_free()` to free the returned string. Returns `NULL` if the offset is invalid or no implementation is available.

The caller of the method takes ownership of the returned data, and is responsible for freeing it.