2016-11-29 154 views
0

我創建使用PowerShell的Word文檔,並想知道如果能夠正確對齊/證明我的文檔中的文本行的Word文檔中:右對齊文本

##### Create Word Object 

$Word = New-Object -ComObject Word.Application 

##### Open Word and make it visible 
$Word.Visible = $True 
$Document = $Word.Documents.Add() 
$Selection = $Word.Selection 

##### Place Date information on document in Bold format and right align 

$Selection.Font.Bold = 1 

##### HOW CAN I RIGHT ALIGN/JUSITY THIS NEXT LINE OF TEXT??? 

$Selection.TypeText("Date of Transcription: " + $Date) 
$Selection.TypeParagraph() 
$Selection.TypeParagraph() 
$Selection.Font.Bold = 0 

回答

1

它應該只是是加入

$Selection.ParagraphFormat.Alignment = 2 

的情況下,我覺得2是右對齊,但沒有一份Word來檢查,如果沒有它的+/- 1兩種方式。