Set-Text-Style
Command Description
Set the style of the currently selected text in the opened Word document
Command Prototype
Word.SetFontStyleEx(objWord,bBold,bItalic,underlineStyle)
Parameter Description
Parameter | Required | Type | Default | Description |
---|---|---|---|---|
objWord | True | expression | objWord | Word document object |
bBold | True | boolean | None | Whether the text is bold; the default is false |
bItalic | True | boolean | None | Whether the text is italic; the default is false |
underlineStyle | True | enum | 0 | The style of underscore |
Demo
/************************************Set font style************* ****************************
Command prototype:
Word.SetFontStyleEx(objWord,bBold,bItalic,underlineStyle)
Input parameters:
objWord--Word document object
bBold--whether the text is bold
bItalic--whether the text is italic
underlineStyle--the style of the underline
*********************************************************************************/
Dim objWord
objWord = Word.Open('''C:\Users\Administrator\Desktop\Standardization Implementation Notes.docx''',"xw4131221","",true)
Word.SelectRow(objWord,3,5)
Word.SetFontStyleEx(objWord,true,true,1)