rtStyle rTextParagraph rtLabel
Border As rtBorderStyle
Font As rtFontstyle
HTML As rtHtmlStyle
Paragraph As rtParagraphstyle
RowDisplay As rtRowDisplayStyle
TableLayout As rtTableStyle
Class for controlling appearance parameters like font for textContainer ( rTextRun) and different appearance components like Borders, table display style. Contain different Style objects depending on context. Not used as an independent object.
The rtStyle and subordinated objects may be associated with different objects in different contexts. Thus you may obtain the style of a particular table or text fragment and apply it to other table or text object. Though although other objects like rtCell may be associated with several containers simultaneously, it is not correct usage and may cause some functionality (like find and replace text) to fail.
The usage of style differs depending on whether the item is being retrieved or is being created.
On retrieval Style objects are created as necessary when some style parameter changes - creating a new style and inheriting unchanged style components. Thus if the font is changed then the new style object contains a new Font object, but the same paragraph style as the previous one. Consequently in order to change the style of some particular text fragment you must create a new style and style component(s) to avoid changing other parts of the same appearance if that is not the purpose.
Set style = new rtStyle(0)
Set style.Paragraph = oldStyle.Paragraph
Set style.Font = new rtFontstyle (0)
' change font
Set TextRun.Style = style ' assign the new style to the piece of text
Set TextRun.Style = oldStyle.Clone
Set TextRun.Font = oldStyle.Font.Clone
During the creation of item content each style is separate and may be applied as necessary to different objects even in different hierarchies.