Powershell Word ZOrder

时间:2017-02-27 19:45:40

标签: powershell ms-word z-order

Powershell忽略了我的ZOrder命令。我使用哪种方法无关紧要。如何修改ZOrder以从PowerShell添加到word文档的图片或形状?

方法1:

$Doc = $Word.Application.Documents.Open($docPath)
$Shape = $Doc.Shapes.AddShape(1, 0, 0, 612, 792)
$Shape.Fill.UserPicture("C:\pic.tif")
$Shape.ZOrder.msoSendToBack

方法2:

$Doc = $Word.Application.Documents.Open($docPath)
$Shape = $Doc.Shapes.AddPicture("C:\pic.tif", $false, $true, 0, 0, 612, 792)
$Shape.ZOrder.msoSendToBack

1 个答案:

答案 0 :(得分:2)

ZOrder是一个带有MsoZOrderCmd的函数调用。所以,你需要这样做:

$msoSendToBack = 1
$Shape.ZOrder($msoSendToBack)

请参阅:https://msdn.microsoft.com/en-us/library/aa432726(v=office.12).aspx了解枚举列表。