PowerShell function Create-HtmlBody was created due to many reasons but only for one purpose: Convert a rich text to HTML code through MS Word.
- Create-HtmlBody returns string that contains data in HTML syntax. The data are generated by Word document.
- The function runs Word application installed on source system (supported Office 2010).
- New document ensures to compose a rich text and data via Word.
- The data in HTML code are saved by pressing a button in PowerShell window from the document to temporary file.
- The file is loaded and data returned to PS window with possibility to save the file on drive.
- It does not support all Word functionality (able to generate HTML code only from something).
- -SaveFileTo [String]
$htmlcode = Create-HtmlBody
Create-HtmlBody -SaveFileTo “c:\temp\BodyTemp01.html”
Download: Create-HtmlBody.ps1 (use right-click and Save as for downloading ps1 file)