This PowerShell module enables you to create Word Documents directly from Powershell. The only prequisites are that you have PowerShell v5 and MS Word installed on your computer.
Latest Release
The latest release of this project is hosted on PowerShell Gallery
This development version of this project is hosted on GitHub
View on Github Watch on Github Fork on Github Star on Github
Install latest release from PowerShell Gallery (Powershell v5)
Install latest released version directly from PowerShell Gallary
install-module -modulename WordDoc -scope currentuser
Install manually (Powershell v3-v4)
- Copy the worddoc.psm1 file to a WordDoc folder into one of the following folders
%userprofile%\Documents\WindowsPowerShell\Modules\WordDoc
%windir%\System32\WindowsPowerShell\v1.0\Modules\WordDoc
Example Script
Once you have installed the module you can now Create Word Document’s from powershell
Import-Module Worddoc
$a = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.'
New-WordInstance
New-WordDocument
Add-WordCoverPage -CoverPage Banded
Add-WordText -text 'Table of Contents' -WDBuiltinStyle wdStyleTitle
Add-WordTOC
Add-WordBreak -breaktype NewPage
Add-WordText -text 'Heading1' -WDBuiltinStyle wdStyleHeading1
Add-WordText -text $text -WDBuiltinStyle wdStyleNormal
ProTip: Be sure to check out other example scripts