Public/PSWordCustomProperties.ps1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
function Add-WordCustomProperty { [CmdletBinding()] param ( [Xceed.Words.NET.Container]$WordDocument, [string] $Name, [string] $Value ) $CustomProperty = New-Object -TypeName Xceed.Words.NET.CustomProperty -ArgumentList $Name, $Value $WordDocument.AddCustomProperty($CustomProperty) } function Get-WordCustomProperty { [CmdletBinding()] param ( [Xceed.Words.NET.Container]$WordDocument, [string] $Name ) if ($Property -eq $null) { return $WordDocument.CustomProperties.Values } else { return $WordDocument.CustomProperties.$Name.Value } } |