Skip to content
This repository was archived by the owner on Apr 12, 2022. It is now read-only.

Commit 7fd4a5d

Browse files
Added example
1 parent e0e7042 commit 7fd4a5d

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

Examples/Example-TextReplace.ps1

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
### Before running this script make sure to run Example-CreateWord first
2+
$FilePath = "C:\Users\przemyslaw.klys\OneDrive - Evotec\Desktop\Word.docx"
3+
$FilePath1 = "C:\Users\przemyslaw.klys\OneDrive - Evotec\Desktop\Word1.docx"
4+
$doc = Get-WordDocument -FilePath $FilePath
5+
$word = "Sample"
6+
$formatObj = New-Object Xceed.Document.NET.Formatting
7+
$formatObj.FontColor = "Red"
8+
foreach ($p in $doc.Paragraphs) {
9+
Set-WordTextReplace -Paragraph $p -SearchValue $word -ReplaceValue $word -NewFormatting $formatObj -Supress $false
10+
}
11+
Save-WordDocument -Document $doc -FilePath $FilePath1

0 commit comments

Comments
 (0)