我已经使用powershell将图像添加到了Word文档中。如何调整大小?
$Word = New-Object -ComObject Word.Application
$Word.Visible = $True
$Document = $Word.Documents.Add()
$Selection = $Word.Selection
$Selection.InlineShapes.AddPicture("$imagelocation")|Out-Null
$Selection.InlineShapes.Height = 50
$Selection.InlineShapes.Width = 50
但是我收到以下错误:
Exception setting "Height":
"The property 'Height' cannot be found on this object. Verify that the property exists and can be set."
Exception setting "Width":
"The property 'Width' cannot be found on this object. Verify that the property exists and can be set."
您正在尝试在包含所有嵌入式形状的集合上设置Height
和。Width
使用由InlineShape
返回的特定对象AddPicture()
:
$newInlineShape = $Selection.InlineShapes.AddPicture("$imagelocation")
$newInlineShape.Height = 50
$newInlineShape.Width = 50
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句