troubleshooting Question

Replace [fields] on word htm file : how to ?

Avatar of Fr. Vandecan
Fr. VandecanFlag for Belgium asked on
PowershellMicrosoft Word
4 Comments1 Solution119 ViewsLast Modified:
Dear,
I have a htm file created with Word.
This file contains a table (see attached). It's in french. no worry. the purpose is to replace [fields] to real values.
To achieve this, my code is this :
$Datas =  (Select-Xml -Path $strFullFile -XPath //body/h4).node.InnerText}

            $datas = $Datas -replace "[EndOfContract]", $DateFrom
            $datas = $Datas -replace "[TypeOfJcDept]", $strMailboxType
            $datas = $Datas -replace "[JcDEPTName]", $strMailboxAlias
en so forth

this does not seems to work as the code seems to completely destroy the htm file.

If I analyze te situation if each letter of [EndOfCOntract] with is seen on the file is replaced. I was expecting the ONLY [EndOFContrat] Beeing replaced by $dateFrom.

so seems that the command is totally wrong....
what else?
any idea? other method to achieve same result?

Many tks.
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros