我正在使用PowerShell创建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
答案 0 :(得分:1)
应该只是添加
的情况$Selection.ParagraphFormat.Alignment = 2
我认为2是对齐,但没有Word的副本可以检查,如果不是+/- 1,无论如何。