LibreOffice LibreOffice 26.2 SDK API Reference

Public Member Functions | List of all members
XSimpleText Interface Referencepublished

is the main interface for a distinct text unit, i.e. More...

`import"XSimpleText.idl";`

Inheritance diagram for XSimpleText:

## Public Member Functions
com::sun::star::text::XTextCursor | createTextCursor ()
com::sun::star::text::XTextCursor | createTextCursorByRange ([in] com::sun::star::text::XTextRange aTextPosition)
void | insertString ([in] com::sun::star::text::XTextRange xRange, [in] string aString, [in] boolean bAbsorb)
| inserts a string of characters into the text. More...
void | insertControlCharacter ([in] com::sun::star::text::XTextRange xRange, [in] short nControlCharacter, [in] boolean bAbsorb) raises ( com::sun::star::lang::IllegalArgumentException )
| inserts a control character (like a paragraph break or a hard space) into the text. More...
Public Member Functions inherited from XTextRange
XText | getText ()
XTextRange | getStart ()
XTextRange | getEnd ()
string | getString ()
void | setString ([in] string aString)
| the whole string of characters of this piece of text is replaced. More...
Public Member Functions inherited from XInterface
any | queryInterface ([in] type aType)
| queries for a new interface to an existing UNO object. More...
void | acquire ()
| increases the reference counter by one. More...
void | release ()
| decreases the reference counter by one. More...

## Detailed Description

is the main interface for a distinct text unit, i.e.

the main text of a document, the text for headers and footers or for single cells of a table.

See also
  XText

Developers Guide
  Text Documents - Editing Text - Strings

## Member Function Documentation

## ◆ createTextCursor()

com::sun::star::text::XTextCursor createTextCursor | ( |  | ) |

Returns
  a new instance of a TextCursor service which can be used to travel in the given text context.

See also
  com::sun::star::text::TextCursor

## ◆ createTextCursorByRange()

com::sun::star::text::XTextCursor createTextCursorByRange | ( | [in] com::sun::star::text::XTextRange | aTextPosition | ) |

Returns
  a new instance of a TextCursor which is located at the specified TextRange to travel in the given text context.

The initial position is set to aTextPosition.

Parameters

  aTextPosition | specifies the start position for the new TextCursor.

See also
  com::sun::star::text::TextCursor

## ◆ insertControlCharacter()

void insertControlCharacter | ( | [in] com::sun::star::text::XTextRange | xRange,
|  | [in] short | nControlCharacter,
|  | [in] boolean | bAbsorb
| ) |  |
raises | ( | com::sun::star::lang::IllegalArgumentException
| ) |  |

inserts a control character (like a paragraph break or a hard space) into the text.

See also
  com::sun::star::text::ControlCharacter

## ◆ insertString()

void insertString | ( | [in] com::sun::star::text::XTextRange | xRange,
|  | [in] string | aString,
|  | [in] boolean | bAbsorb
| ) |  |

inserts a string of characters into the text.

The string may contain the following white spaces:

- blank
- tab
- cr (which will insert a paragraph break)
- lf (which will insert a line break)

Parameters

  xRange | specifies the position of insertion. For example, XSimpleText::createTextCursor() can be used to get an XTextRange for this argument.

If the parameter bAbsorb() was `TRUE` the text range will contain the new inserted string, otherwise the range (and it's text) will remain unchanged.

Parameters

  aString | specifies the string to insert.
  bAbsorb | specifies whether the text spanned by xRange will be replaced. If `TRUE` then the content of xRange will be replaced by aString, otherwise aString will be inserted at the beginning of xRange.

xText.insertString( xTextCursor, "Hello " + aName + ",", false )
xText.insertControlCharacter( xTextCursor,
ControlCharacter.PARAGRAPH_BREAK, false );
xText.insertString( xTextCursor, "more text ...", false )

The documentation for this interface was generated from the following file:

- com/sun/star/text/XSimpleText.idl