Object

Paragraph Class

A paragraph of StyledText.

Properties
Alignment
EndPos
Length
StartPos

# Notes

Use the Paragraph class to refer to a paragraph of text within a block of StyledText. A paragraph is defined as all the text between two paragraph separators. A separator can be the EndOfLine function or the correct separator character for the platform on which the application is running. Completely empty paragraphs (e.g., blank lines) do not count as paragraphs.

You use the ParagraphCount method of the StyledText class to get the number of paragraphs in the StyledText object and the Paragraph method of the StyledText class to refer to a particular paragraph.

The Paragraph has one style attribute, Alignment. It gets the current alignment for the paragraph. The alignment is set by calling the ParagraphAlignment method of the StyledText class.

# Example

The following example sets a paragraph's alignment to Centered. It then gets the starting position and length of the paragraph via the Paragraph class and applies several style attributes to the whole paragraph. The EditField that displays the styled text must have the MultiLine and Styled properties set to True.

Dim Text as String
Dim st,ln as Integer
//define four paragraphs in Text
Text = "This is the text that we are going to save " _
+"into our file from the EditField."+ EndOfLine _
+"Isn't that interesting?"+ EndOfLine _
+"Man, I sure do love using RB to take care of my projects."+ EndOfLine _
+"That's because the RS Engineering staff is just so awesome!"
EditField1.StyledText.Text = text //four paragraphs in Text
//center the second paragraph
EditField1.StyledText.ParagraphAlignment(1)=Paragraph.AlignCenter
//set the second paragraph in Helveticta, 18 pt bold, red
//first get its character positions...
st=EditField1.StyledText.Paragraph(1).StartPos-1
ln=EditField1.StyledText.Paragraph(1).Length
//next apply attributes...
EditField1.StyledText.Bold(st,ln)= True
EditField1.StyledText.Font(st,ln)="Helvetica"
EditField1.StyledText.Size(st,ln)=18
EditField1.StyledText.TextColor(st,ln)= &cFF0000 //red

# See Also

EditField, Range, StyledText, StyleRun classes.