Skip to main content
Version: v6.5.0

Set-Alignment

Command Description​

Set alignment of the currently selected text in an opened Word document

Command Prototype​

Word.SetAlign(objWord,sAlign)

Parameter Description​

ParameterRequiredTypeDefaultDescription
objWordTrueexpressionobjWordWord document object
sAlignTrueenum"left"The alignment of selected content, the default is left alignment

Demo​

/************************************Set alignment************* **************************** 
Command prototype:
Word.SetAlign(objWord,sAlign)
Input parameters:
objWord--Word document object
sAlign-- the alignment of the selected content, the default is left-aligned
*********************************************************************************/
Dim objWord , sRet
objWord = Word.Open('''C:\Users\Administrator\Desktop\Standardization Implementation Notes.docx''',"xw4131221","",true)
Word.SetAlign(objWord,"center")