SelectStyle Method

[Top]  [Chapter]  [Previous]  [Next]


void SelectStyle(string StyleName);


Selects a certain style. The style can be then manipulated through interface CurrStyle and CurrStyleAttr.


VB.NET example:


'initialize the reference to "Memo"  

Dim Memo As IWPEditor

Memo = Me.WpdllInt1.Memo

'Create a new header (for all pages) and place the cursor inside

Memo.TextCursor.InputHeader(0, "", "")

'create a text style called "myStyle", this is not used for the actual header, confusing isn't it

'Selects a certain style. The style can be then manipulated through interface CurrStyle.


'This interface is used to change the character attributes defined by the current style.

Memo.CurrStyleAttr.SetFontface("Times New Roman")


'Now set paragraph attributes

Memo.CurrStyle.Alignment = 1 '0=lLeft, 1=Center, 2=Right, 3=Justified

'now apply this style to the current paragraph


'clear the writing attributes otherwise the style is not used

'because the style attributes are overridden by the character attributes

Memo.CurrPar.StyleName = "myStyle"

Memo.TextCursor.InputText("Header added programmatically") ' can't see how to add page numbers etc

'Goto Body


'This is required if you change a paragraph style

Memo.ReformatAll(True, True)


Please also see InputRowStart - there we added an VB.NET example which creates a table using merged cells and paragraph styles.


Paragraphstyle Support

[idh_iwpmemo_selectstyle.htm]    Copyright © 2007 by WPCubed GmbH