LOTUSSCRIPT/COM/OLE CLASSES


Working with text in LotusScript classes
Example

Text includes text paragraphs and text runs, rich text styles, rich text paragraph styles, and tabs. A text run is text until the style changes or the paragraph ends.

Text paragraphs and text runs

To find text in a rich text item, use the NotesRichTextNavigator methods in conjunction with the type RTELEM_TYPE_TEXTPARAGRAPH or RTELEM_TYPE_TEXTRUN. To get text, create a NotesRichTextRange object and delineate the text with the following methods:


For example, if you find an element of type RTELEM_TYPE_TEXTPARAGRAPH with NotesRichTextNavigator, then call SetBegin passing it the navigator, your range starts at that paragraph.

The NotesRichTextRange class has the following properties:

PropertyData TypeDescription
NavigatorNotesRichTextNavigator(Read-only) A navigator confined to the range. This allows you, for example, to get the text runs in a text paragraph.
StyleNotesRichTextStyle(Read-only) The style of the first text run in the range.
TextParagraphString(Read-only) The text of the first paragraph in the range.
TextRunString(Read-only) The text of the first run in the range.
TypeString(Read-only) The type of the first element in the range.
In addition to SetBegin and SetEnd, the NotesRichTextRange class has the following methods:
Text creation

To create text in a rich text item, use the following methods:


Rich text styles

You can access rich text style properties through the NotesRichTextStyle class. The NotesRichTextStyle class contains the following properties:

PropertyData TypeDescription
Bold Boolean or Constant(Read-write) Bold rich text attribute.
Effects Constant(Read-wite) Effects (emboss, extrude, etc.).
FontSize Integer(Read-write) Font size in points.
IsDefaultBooleanIndicates whether all rich text style attributes are at the default state.
Italic Boolean or Constant(Read-write) Italic rich text attribute.
NotesColor Constant(Read-write) Color rich text attribute.
NotesFont Constant(Read-write) Font rich text attribute.
Parent NotesSessionThe session that contains a RichTextStyle object. For COM only.
PassThruHTML Boolean(Read-write) HTML attribute.
StrikeThrough Boolean or Constant(Read-write) Strikethrough rich text attribute.
Underline Boolean or Constant(Read-write) Underline rich text attribute.

AppendStyle appends a style to the end of a rich text item. Text following the style is rendered using that styles's attributes until another style is appended.

Use a NotesRichTextStyle object with AppendStyle in NotesRichTextItem. At creation, all the NotesRichTextStyle attributes are in the default state STYLE_NO_CHANGE (255).

Use GetNotesFont in NotesRichTextItem to establish font identifiers for NotesFont.

Rich text paragraph styles

The NotesRichTextParagraphStyle allows you to access the following attributes of a rich text paragraph object:

PropertyData typeDescription
Alignment Constant(Read-write) Alignment attribute of a rich text paragraph.
FirstLineLeftMargin Long(Read-write) First line left margin attribute of a rich text paragraph.
InterLineSpacing Constant(Read-write) Interline spacing attribute of a rich text paragraph.
LeftMargin Long(Read-write) Left margin attribute of a rich text paragraph.
RightMargin Long(Read-write) Right margin attribute of a rich text paragraph.
SpacingAbove Constant(Read-write) Spacing above attribute of a rich text paragraph.
SpacingBelow Constant(Read-write) Spacing below attribute of a rich text paragraph.
Tabs Variant(Read-only) Tabs in a rich text paragraph style.
Use the CreateRichTextParagraphStyle method of NotesSession to create a new rich text paragraph style object.

Tabs

You can manipulate the tabs in a rich text paragraph style object through the ClearAllTabs, SetTab, and SetTabs and Clear methods in the NotesRichTextParagraphStyle and RichTextTab classes.

The following table lists the properties in the RichTextTab class.

PropertyDescription
Position (Read-write) Position of a tab in a rich text paragraph style
Type (Read-write) Type of tab

Example
See Also