WordDoc.psm1

#requires -version 4.0
<#
    .SYNOPSIS
    WordDoc helps you quickly generate Word Documents from PowerShell quickly and effortless.
 
    .DESCRIPTION
    WordDoc helps you quickly generate Word Documents from PowerShell quickly and effortless.
       
    .EXAMPLE
    import-module -name WordDoc
    Imports the WordDoc module into the current Powershell Instance
 
    .LINK
    Project Site
    https://shanehoey.github.io/worddoc/
 
    .LINK
    License
    https://shanehoey.github.io/worddoc/license/
 
#>


try { Add-Type -AssemblyName Microsoft.Office.Interop.Word }
catch { Write-Warning  -Message "$($MyInvocation.InvocationName) - Unable to add Word Assembly, Word must be installed for this module to work" }

function New-WordInstance {
  <#
    .SYNOPSIS
    The New-WordInstance function starts a new instance of MS Word.
 
    .DESCRIPTION
    The New-WordInstance function starts a new instance of MS Word.
 
    .PARAMETER returnobject
    When used the function will return the Word Instance as an Object to be stored in a variable in the local shell.
    If using this method you must use worddocobject as well, and manually parse these objects to all functions.
 
    .PARAMETER Visable
    Makes MS Word application Visable or Hidden
 
    .EXAMPLE
    New-WordInstance -Visable True
     
    Create a new Word Instance that is visable
     
    .EXAMPLE
    New-WordInstance -Visable False
 
    Create a new Word Instance that is hidden
     
    .EXAMPLE
    $wi = New-WordInstance -wordinstanceobject
 
    Create a word instance that is stored in a local variable
     
    .INPUTS
 
    .OUTPUTS
     [Microsoft.Office.Interop.Word.Application]
 
    .NOTES
    for more examples visit https://shanehoey.github.io/worddoc/
 
    .LINK
 
    New-WordInstance
 
    https://shanehoey.github.io/worddoc/docs/new-wordinstance
 
  #>


    [CmdletBinding()]
    Param( 
        [switch]$returnobject,

        [bool]$Visable = $true
        )
    Begin { 
        Write-Verbose -Message "[Start] *** $($Myinvocation.InvocationName) ***" 
        try { Add-Type -AssemblyName Microsoft.Office.Interop.Word }
        catch { Write-Warning  -Message "$($MyInvocation.InvocationName) - Unable to add Word Assembly, Word must be installed for this module... exiting" ; break }
        if (!($returnobject)) { 
            try { if (test-path -Path variable:script:WordInstance) {throw 'WordInstance already exists'} }
            catch { Write-Warning -Message "$($MyInvocation.InvocationName) - $($_.exception.message)" ; break }
            }
        }
    Process { 
        try { $WordInstance = New-Object -ComObject Word.Application -Property @{Visible = $Visable} }
        catch { Write-Warning -Message "$($MyInvocation.InvocationName) - Unable to Invoke Word... exiting" ; break }
        try { if ($returnobject) { return $WordInstance } else { New-Variable -Name 'WordInstance' -Value $WordInstance -scope script -ErrorAction SilentlyContinue } }
        catch { Write-Warning -Message "$($MyInvocation.InvocationName) - Unable to create variable... exiting" ; break }   
        }
    End { 
        Write-Verbose -Message "[End] *** $($Myinvocation.InvocationName) ***" 
    }
    }

function Get-WordInstance {
    <#
      .SYNOPSIS
      This function is used to return a Word Instance created automatically by Word Doc Module
   
      .DESCRIPTION
      This function is used to return a Word Instance created automatically by Word Doc Module
   
      .PARAMETER WordInstance
      Not required as this function will work without using WordInstance Parameter
   
      .EXAMPLE
      Get-WordInstance -WordInstance Value
      Describe what this call does
   
      .NOTES
      for more examples visit https://shanehoey.github.io/worddoc/
   
      .LINK
      https://shanehoey.github.io/worddoc/docs/get-wordinstance
   
    #>

 
    [CmdletBinding()]
    Param(  
        [Parameter(Position = 0,DontShow)] 
        [Microsoft.Office.Interop.Word.Application]$WordInstance = $Script:WordInstance
        )
    Begin { 
          Write-Verbose -Message "[Start] *** $($Myinvocation.InvocationName) ***" 
          try { $null = test-wordinstance -wordinstance $wordInstance }
          catch { Write-Warning -Message "$($MyInvocation.InvocationName) - $($_.exception.message)"; break }
        }
      Process { return $wordInstance }
      End { Write-Verbose -Message "[End] *** $($Myinvocation.InvocationName) ***" }
    }

function Test-WordInstance {
  <#
    .SYNOPSIS
    Returns True or False if parsed object is a MS-Word Application.
 
    .DESCRIPTION
    Returns True or False if parsed object is a MS-Word Application.
 
    .PARAMETER WordInstance
    Object that you want to check if it is a MS Word Application
 
    .EXAMPLE
 
    test-WordInstance -WordInstance $wi
     
    Tests is $wi is a MS Word Application object
 
    .INPUTS
 
    .OUTPUTS
    [Boolean]
 
    This function returns a Boolean.
 
    .NOTES
    for more examples visit https://shanehoey.github.io/worddoc/
 
    .LINK
    https://shanehoey.github.io/worddoc/docs/test-wordinstance
     
  #>


    [CmdletBinding()]
    Param(  
        [Parameter(Position = 0)] 
        $WordInstance = $Script:WordInstance
    )
    Begin { Write-Verbose -Message "[Start] *** $($Myinvocation.InvocationName) ***" }
    Process { 
        if ($WordInstance -is [Microsoft.Office.Interop.Word.Application]) {
            return $true
        }
        else { 
            throw "Object is not type [Microsoft.Office.Interop.Word.Document]"
            return $false
        }
    }
    End { Write-Verbose -Message "[End] *** $($Myinvocation.InvocationName) ***" }
    }

function Close-WordInstance {
    <#
      .SYNOPSIS
      Describe purpose of "Close-WordInstance" in 1-2 sentences.
   
      .DESCRIPTION
      Add a more complete description of what the function does.
   
      .PARAMETER WordInstance
      Describe parameter -WordInstance.
   
      .EXAMPLE
      Close-WordInstance -WordInstance Value
      Describe what this call does
   
      .NOTES
      for more examples visit https://shanehoey.github.io/worddoc/
   
      .LINK
      https://shanehoey.github.io/worddoc/docs/close-wordinstance
   
    #>

  
    [CmdletBinding()]
    param(
        [Microsoft.Office.Interop.Word.Application]$WordInstance = $Script:WordInstance
      )
    Begin { 
          Write-Verbose -Message "[Start] *** $($Myinvocation.InvocationName) ***" 
          try { $null = test-wordinstance -WordInstance $wordinstance }
          catch { Write-Warning -Message "$($MyInvocation.InvocationName) - $($_.exception.message)"; break }
        }
    Process {     
        try {
            $WordInstance.Quit()  
            if (test-path variable:script:WordInstance) { remove-variable WordInstance -Scope Script }
            if (test-path variable:script:Worddocument) { remove-variable WordDocument -Scope Script }
            }
        catch { Write-Warning -Message "$($MyInvocation.InvocationName) - $($_.exception.message)" }
        }
    End { Write-Verbose -Message "End : $($Myinvocation.InvocationName)" }
    }

function New-WordDocument {
    <#
      .SYNOPSIS
      Describe purpose of "New-WordDocument" in 1-2 sentences.
   
      .DESCRIPTION
      Add a more complete description of what the function does.
   
      .PARAMETER WordInstance
      Describe parameter -WordInstance.
   
      .PARAMETER returnobject
      Describe parameter -returnobject.
   
      .EXAMPLE
      New-WordDocument -WordInstance Value -WordDocObject
      Describe what this call does
   
      .NOTES
      for more examples visit https://shanehoey.github.io/worddoc/
   
      .LINK
      https://shanehoey.github.io/worddoc/docs/new-worddocument
   
    #>

    
      [CmdletBinding()]
      Param(  
          [Parameter(Position = 0)] 
          [Microsoft.Office.Interop.Word.Application]$WordInstance = $Script:WordInstance,
   
          [switch]$returnobject
        )
      Begin { 
          Write-Verbose -Message "[Start] *** $($Myinvocation.InvocationName) ***"
          try { $null = test-wordinstance -WordInstance $wordinstance }
          catch { Write-Warning -Message "$($MyInvocation.InvocationName) - $($_.exception.message)"; break }
          if (!($returnobject)) { 
            try { if (test-path -Path variable:script:WordDocument) {throw 'WordDocument already exists'} }
            catch { Write-Warning -Message "$($MyInvocation.InvocationName) - $($_.exception.message)" ; break }
            }
        }
      Process { 
          try {
              $WordDocument = $WordInstance.Documents.Add()
              $WordDocument.Activate()
              try { if ($returnobject) { return $WordDocument } else { New-Variable -Name 'WordDocument' -Value $WordDocument -scope script -ErrorAction SilentlyContinue } }
              catch { Write-Warning -Message "$($MyInvocation.InvocationName) - Unable to create variable... exiting" ; break }   
            }
            catch { Write-Warning -Message "$($MyInvocation.InvocationName) - $($_.exception.message)" }

        }
      End { Write-Verbose -Message "End : $($Myinvocation.InvocationName)"  }
  }

function Get-WordDocument {
  <#
    .SYNOPSIS
    Describe purpose of "Get-WordDoc" in 1-2 sentences.
 
    .DESCRIPTION
    Add a more complete description of what the function does.
 
    .PARAMETER WordDocument
    Describe parameter -WordDocument.
 
    .EXAMPLE
    Get-WordDocument -WordDocument Value
    
 
    .NOTES
    for more examples visit https://shanehoey.github.io/worddoc/
 
    .LINK
    https://shanehoey.github.io/worddoc/docs/get-worddocument
 
  #>



    [CmdletBinding()]
    Param(  
        [Parameter(Position = 0,DontShow)] 
        [Microsoft.Office.Interop.Word.Document]$WordDocument = $Script:WordDocument
    )
    Begin {
        Write-Verbose -Message "[Start] *** $($Myinvocation.InvocationName) ***" 
        try { $null = test-WordDocument -WordDocument $WordDocument }
        catch { Write-Warning -Message "$($MyInvocation.InvocationName) - $($_.exception.message)"; break }
    }
    Process { return $WordDocument}
    End { Write-Verbose -Message "[End] *** $($Myinvocation.InvocationName) ***" }
    }

function Test-WordDocument {
  <#
    .SYNOPSIS
    Returns True or False if parsed object is a MS-Word Document.
 
    .DESCRIPTION
    Returns True or False if parsed object is a MS-Word Document.
 
    .PARAMETER WordDocument
    Object that you want to check if it is a MS Word Document
 
    .EXAMPLE
    test-WordDocument -WordDocument $wd
 
    tests is $wd is a MS Word Document Object
 
    .NOTES
    for more examples visit https://shanehoey.github.io/worddoc/
 
    .LINK
    https://shanehoey.github.io/worddoc/docs/test-worddocument
 
  #>


    [CmdletBinding()]
    Param(  
        [Parameter(Position = 0)] 
        $WordDocument = $Script:WordDocument
    )
    Begin { Write-Verbose -Message "[Start] *** $($Myinvocation.InvocationName) ***" }
    Process {
        if ($WordDocument -is [Microsoft.Office.Interop.Word.Document]) {
            return $true
        }
        else { 
            throw "Object is not type [Microsoft.Office.Interop.Word.Document]"
            return $false
        }
    }
    End { Write-Verbose -Message "[End] *** $($Myinvocation.InvocationName) ***" }
    }

function Save-WordDocument {
  <#
    .SYNOPSIS
    Save a Word Document (also .pdf and .html)
 
    .DESCRIPTION
    Save a Word Document (also .pdf and .html)
 
    .PARAMETER WordDocument
    Word Document to save
 
    .PARAMETER WordSaveFormat
    Format to save document as.
 
    .PARAMETER filename
    Filename to save document as
 
    .PARAMETER folder
    Folder to save document in
 
    .EXAMPLE
    Save-WordDocument -WordSaveFormat wdFormatDocument -filename worddoc.docx -folder c:\users\shane\documents\
     
    Saves document as a standard Word Document in c:\users\shane\documents\worddoc.docx
 
      .EXAMPLE
    Save-WordDocument
 
    Opens a save-as GUI, allowing you to save as a docx, html, or pdf file.
 
    .NOTES
    for more examples visit https://shanehoey.github.io/worddoc/
 
    .LINK
    https://shanehoey.github.io/worddoc/docs/save-worddocument
 
  #>

    [CmdletBinding()]
    Param( 
        
        [Parameter(ParameterSetName = "Default")]
        [Parameter(ParameterSetName = "Defined")]
        [Microsoft.Office.Interop.Word.Document]$WordDocument = $Script:WordDocument,
        
        [Parameter(Mandatory=$true,ParameterSetName = "Defined")]
        [string]$filename,

        [Parameter(Mandatory=$true,ParameterSetName = "Defined")]
        [Microsoft.Office.Interop.Word.WdSaveFormat]$WordSaveFormat,
     
        [Parameter(ParameterSetName = "Defined")]
        [Parameter(ParameterSetName = "Default")]
        [String]$folder = [Environment]::GetFolderPath('MyDocuments')
    )
    Begin { Write-Verbose -Message "[Start] *** $($Myinvocation.InvocationName) ***" 
        try { 
            $null = test-WordDocument -WordDocument $WordDocument 
            Add-Type -AssemblyName System.windows.forms
            }
        catch { Write-Warning -Message "$($MyInvocation.InvocationName) - $($_.exception.message)"; break }
        }
    Process { 
        try {
            if ($PSBoundParameters.ContainsKey('filename')) { $filepath = (Join-Path -path $folder -ChildPath $filename) } 
            else { 
                $SaveFileDialog = New-Object -TypeName System.Windows.Forms.saveFileDialog
                $SaveFileDialog.InitialDirectory = [Environment]::GetFolderPath('MyDocuments')
                $SaveFileDialog.filter = 'Word Document (*.docx)|*.docx|HTML File (*.html)|*.html|PDF (*.pdf)|*.pdf'
                [void]$SaveFileDialog.ShowDialog()
                $filepath = $SaveFileDialog.FileName
                switch ($SaveFileDialog.FilterIndex) { 
                    1 { [Microsoft.Office.Interop.Word.WdSaveFormat]$WordSaveFormat = "wdFormatDocumentdefault" }
                    2 { [Microsoft.Office.Interop.Word.WdSaveFormat]$WordSaveFormat = "wdFormatHTML" }
                    3 { [Microsoft.Office.Interop.Word.WdSaveFormat]$WordSaveFormat = "wdFormatPDF" }
                }

                }
            $null = $WordDocument.SaveAs([ref]($filepath) , [ref]$WordSaveFormat) 
            }
        catch { Write-Warning -Message "$($MyInvocation.InvocationName) - $($_.exception.message)" }
        }
    End { Write-Verbose -Message "End : $($Myinvocation.InvocationName)"  }
    }

function Close-WordDocument {
  <#
    .SYNOPSIS
    Describe purpose of "Close-WordDocument" in 1-2 sentences.
 
    .DESCRIPTION
    Add a more complete description of what the function does.
 
    .PARAMETER WordInstance
    Describe parameter -WordInstance.
 
    .PARAMETER WordDocument
    Describe parameter -WordDocument.
 
    .EXAMPLE
    Close-WordDocument -WordInstance Value -WordDocument Value
    Describe what this call does
 
    .NOTES
    for more examples visit https://shanehoey.github.io/worddoc/
 
    .LINK
    https://shanehoey.github.io/worddoc/docs/close-worddocument
 
  #>



    [CmdletBinding()]
    param(
        [Microsoft.Office.Interop.Word.Application]$WordInstance = $Script:WordInstance,
  
        [Microsoft.Office.Interop.Word.Document]$WordDocument = $Script:WordDocument
    )
    Begin { 
        Write-Verbose -Message "[Start] *** $($Myinvocation.InvocationName) ***"  
        try { 
            $null = test-wordinstance -WordInstance $wordinstance
            $null = test-WordDocument -WordDocument $worddocument
        }
        catch { Write-Warning -Message "$($MyInvocation.InvocationName) - $($_.exception.message)"; break }
    }
    Process {     
        try {
            $WordDocument.Close() 
            if (test-path variable:script:Worddocument) { remove-variable WordDocument -Scope Script }

        }
        catch {
            Write-Warning -Message "$($MyInvocation.InvocationName) - $($_.exception.message)"
        }
    }
    End { Write-Verbose -Message "End : $($Myinvocation.InvocationName)" }
    }


function Add-WordBreak {
  <#
    .SYNOPSIS
    Create a new Break (newpage,section or paragraph)
 
    .DESCRIPTION
     Create a new Break (newpage,section or paragraph)
 
    .PARAMETER breaktype
    Type of break (newpage,section or paragraph)
 
    .PARAMETER WordInstance
    Describe parameter -WordInstance.
 
    .PARAMETER WordDocument
    Describe parameter -WordDocument.
 
    .EXAMPLE
    Add-WordBreak -breaktype NewPage
    Creates a NewPage Break
 
    .NOTES
    for more examples visit https://shanehoey.github.io/worddoc/
 
    .LINK
    https://shanehoey.github.io/worddoc/docs/add-wordinstance
 
 
  #>


    [CmdletBinding()]
    param (
        [Parameter(Position = 0)] 
        [Parameter(ParameterSetName = 'GridTable')]
        [ValidateSet('NewPage', 'Section', 'Paragraph')]
        [string]$breaktype = 'NewPage',
   
        [Microsoft.Office.Interop.Word.Application]$WordInstance = $Script:WordInstance,
    
        [Microsoft.Office.Interop.Word.Document]$WordDocument = $Script:WordDocument
    )
 
    Begin {
        Write-Verbose -Message "[Start] *** $($Myinvocation.InvocationName) ***"
        try {  $null = test-wordinstance -WordInstance $wordinstance 
               $null =  test-WordDocument -WordDocument $WordDocument 
            }
        catch { Write-Warning -Message "$($MyInvocation.InvocationName) - $($_.exception.message)"; break }
    }
    Process { 
        try {  
            switch ($breaktype) { 
                'NewPage' { $null =  $WordInstance.Selection.InsertNewPage() }
                'Section' { $null = $WordInstance.Selection.Sections.Add() }
                'Paragraph' { $null =  $WordInstance.Selection.InsertParagraph() } 
            }
            $null = $WordDocument.application.selection.goto([Microsoft.Office.Interop.Word.WdGoToItem]::wdGoToBookmark, $null, $null, '\EndOfDoc')
        }
        catch { Write-Warning -Message "$($MyInvocation.InvocationName) - $($_.exception.message)" }
    }
    End { 
        Write-Verbose -Message "End : $($Myinvocation.InvocationName)"
    }
    }

function Add-WordCoverPage {
  <#
    .SYNOPSIS
    Describe purpose of "Add-WordCoverPage" in 1-2 sentences.
 
    .DESCRIPTION
    Add a more complete description of what the function does.
 
    .PARAMETER CoverPage
    Describe parameter -CoverPage.
 
    .PARAMETER WordInstance
    Describe parameter -WordInstance.
 
    .PARAMETER WordDocument
    Describe parameter -WordDocument.
 
    .EXAMPLE
    Add-WordCoverPage -CoverPage Value -WordInstance Value -WordDocument Value
    Describe what this call does
 
    .NOTES
    for more examples visit https://shanehoey.github.io/worddoc/
 
    .LINK
    https://shanehoey.github.io/worddoc/docs/add-wordcoverpage
 
  #>


    [CmdletBinding()]
    param(
        #Todo cast type instead ie [Microsoft.Office.Interop.Word]
        [Parameter(Position = 0)] 
        [ValidateSet('Austin', 'Banded', 'Facet', 'Filigree', 'Grid', 'Integral', 'Ion (Dark)', 'Ion (Light)', 'Motion', 'Retrospect', 'Semaphore', 'Sideline', 'Slice (Dark)', 'Slice (Light)', 'Viewmaster', 'Whisp')]  
        [string]$CoverPage = 'Facet',
    
        [Microsoft.Office.Interop.Word.Application]$WordInstance = $Script:WordInstance,
    
        [Microsoft.Office.Interop.Word.Document]$WordDocument = $Script:WordDocument
    )  
    Begin { 
        Write-Verbose -Message "[Start] *** $($Myinvocation.InvocationName) ***"
        try {  $null = test-wordinstance -WordInstance $wordinstance 
               $null = test-WordDocument -WordDocument $WordDocument 
            }
        catch { Write-Warning -Message "$($MyInvocation.InvocationName) - $($_.exception.message)"; break }
    }
    Process { 
        try {
            $Selection = $WordDocument.application.selection
            $WordInstance.Templates.LoadBuildingBlocks()
            $bb = $WordInstance.templates | Where-Object -Property name -EQ -Value 'Built-In Building Blocks.dotx'
            $part = $bb.BuildingBlockEntries.item($CoverPage)
            $null = $part.Insert($WordInstance.Selection.range, $true) 
            $null = $Selection.goto([Microsoft.Office.Interop.Word.WdGoToItem]::wdGoToBookmark, $null, $null, '\EndOfDoc')
        }
        catch {
            Write-Warning -Message "$($MyInvocation.InvocationName) - $($_.exception.message)"
        }
    }
    End { 
        Write-Verbose -Message "End : $($Myinvocation.InvocationName)" 
    }
    }

function Add-WordTable {
  <#
    .SYNOPSIS
    Describe purpose of "Add-WordTable" in 1-2 sentences.
 
    .DESCRIPTION
    Add a more complete description of what the function does.
 
    .PARAMETER Object
    Describe parameter -Object.
 
    .PARAMETER WdAutoFitBehavior
    Describe parameter -WdAutoFitBehavior.
 
    .PARAMETER WdDefaultTableBehavior
    Describe parameter -WdDefaultTableBehavior.
 
    .PARAMETER HeaderRow
    Describe parameter -HeaderRow.
 
    .PARAMETER TotalRow
    Describe parameter -TotalRow.
 
    .PARAMETER BandedRow
    Describe parameter -BandedRow.
 
    .PARAMETER FirstColumn
    Describe parameter -FirstColumn.
 
    .PARAMETER LastColumn
    Describe parameter -LastColumn.
 
    .PARAMETER BandedColumn
    Describe parameter -BandedColumn.
 
    .PARAMETER WDTableFormat
    Describe parameter -WDTableFormat.
 
    .PARAMETER PlainTable
    Describe parameter -PlainTable.
 
    .PARAMETER GridTable
    Describe parameter -GridTable.
 
    .PARAMETER ListTable
    Describe parameter -ListTable.
 
    .PARAMETER ListAccent
    Describe parameter -ListAccent.
 
    .PARAMETER GridAccent
    Describe parameter -GridAccent.
 
    .PARAMETER RemoveProperties
    Describe parameter -RemoveProperties.
 
    .PARAMETER VerticleTable
    Describe parameter -VerticleTable.
 
    .PARAMETER NoParagraph
    Describe parameter -NoParagraph.
 
    .PARAMETER WordDocument
    Describe parameter -WordDocument.
 
    .EXAMPLE
    Add-WordTable -Object Value -WdAutoFitBehavior Value -WdDefaultTableBehavior Value -HeaderRow Value -TotalRow Value -BandedRow Value -FirstColumn Value -LastColumn Value -BandedColumn Value -RemoveProperties -VerticleTable -NoParagraph -WordDocument Value
    Describe what this call does
 
    .EXAMPLE
    Add-WordTable -WDTableFormat Value
    Describe what this call does
 
    .EXAMPLE
    Add-WordTable -PlainTable Value
    Describe what this call does
 
    .EXAMPLE
    Add-WordTable -GridTable Value -GridAccent Value
    Describe what this call does
 
    .EXAMPLE
    Add-WordTable -ListTable Value -ListAccent Value
    Describe what this call does
 
    .NOTES
    for more examples visit https://shanehoey.github.io/worddoc/
 
    .LINK
    https://shanehoey.github.io/worddoc/docs/add-wordtable
 
  #>



    [CmdletBinding()]
    param(
        [Parameter(Position = 0, HelpMessage = 'psobject to send to word', Mandatory = $true, ValuefromPipeline = $true)]    
        [psobject]$Object,
  
        [Microsoft.Office.Interop.Word.WdAutoFitBehavior]$WdAutoFitBehavior = 'wdAutoFitContent',

        [Microsoft.Office.Interop.Word.WdDefaultTableBehavior]$WdDefaultTableBehavior = 'wdWord9TableBehavior', 

        [bool]$HeaderRow = $true,
    
        [bool]$TotalRow = $false,
    
        [bool]$BandedRow = $true,
    
        [bool]$FirstColumn = $false,
    
        [bool]$LastColumn = $false,
    
        [bool]$BandedColumn = $false,

        [Parameter(ParameterSetName = 'WDTableFormat')]
        [Microsoft.Office.Interop.Word.WdTableFormat]$WDTableFormat = 'wdTableFormatNone',
    
        #Todo: Investigate how to do better thru [Microsoft.Office.Interop.Word.??????]
        [Parameter(ParameterSetName = 'PlainTable')]
        [validateSet('Table Grid', 'Table Grid Light', 'Plain Table 1', 'Plain Table 2', 'Plain Table 3', 'Plain Table 4', 'Plain Table 5')]
        [String]$PlainTable = 'Table Grid',

    
        #Todo: Investigate how to do better thru [Microsoft.Office.Interop.Word.??????]
        #Todo: Investigate $table.ApplyStyleDirectFormatting("Grid Table 5 Dark")
        [Parameter( ParameterSetName = 'GridTable')]
        [ValidateSet('Grid Table 1 Light', 'Grid Table 2', 'Grid Table 3', 'Grid Table 4', 'Grid Table 5 Dark', 'Grid Table 6 Colorful', 'Grid Table 7 Colorful')]
        [String]$GridTable = 'Grid Table 1 Light',
    
        #Todo: Investigate how to do better thru [Microsoft.Office.Interop.Word.??????]
        [Parameter( ParameterSetName = 'ListTable')]
        [ValidateSet('List Table 1 Light', 'List Table 2', 'List Table 3', 'List Table 4', 'List Table 5 Dark', 'List Table 6 Colorful', 'List Table 7 Colorful')]
        [String]$ListTable = 'List Table 1 Light',
    
        #Todo: Investigate how to do better thru [Microsoft.Office.Interop.Word.??????]
        [Parameter( ParameterSetName = 'ListTable')]
        [ValidateSet('Accent 1', 'Accent 2', 'Accent 3', 'Accent 4', 'Accent 5', 'Accent 6')]
        [String]$ListAccent = 'Accent 1',
    
        #Todo: Investigate how to do better thru [Microsoft.Office.Interop.Word.??????]
        [Parameter( ParameterSetName = 'GridTable')]
        [ValidateSet('Accent 1', 'Accent 2', 'Accent 3', 'Accent 4', 'Accent 5', 'Accent 6')]
        [string]$GridAccent = 'Accent 1',
    
        [switch]$RemoveProperties,
    
        [switch]$VerticleTable,
    
        [switch]$NoParagraph,
    
        [Microsoft.Office.Interop.Word.Document][Object]$WordDocument = $Script:WordDocument
    )
   
    Begin {
        try { $null = test-WordDocument -WordDocument $WordDocument }
        catch { Write-Warning -Message "$($MyInvocation.InvocationName) - $($_.exception.message)"; break }
    }
    Process { 
        try {
            $TableRange = $WordDocument.application.selection.range  
            if (!($VerticleTable)) {
                $Columns = @($Object | Get-Member -MemberType Property, NoteProperty).count
                if ($RemoveProperties) { $Rows = @($Object).count } 
                else {$Rows = @($Object).count + 1 }
            }
            if ($VerticleTable) {
                if ($RemoveProperties) { $Columns = @($Object).count } 
                else {$Columns = @($Object).count + 1 }
                $Rows = @($Object | Get-Member -MemberType Property, NoteProperty).count
            }
            $Table = $WordDocument.Tables.Add($TableRange, $Rows, $Columns, $WdDefaultTableBehavior, $WdAutoFitBehavior) 
            if ($PSBoundParameters.ContainsKey('WDTableFormat')) { $Table.autoformat([Microsoft.Office.Interop.Word.WdTableFormat]::$WDTableFormat) }  
            if ($PSBoundParameters.ContainsKey('PlainTable')) { $Table.style = $PlainTable } 
            if ($PSBoundParameters.ContainsKey('GridTable')) { 
                if ($PSBoundParameters.ContainsKey('GridAccent')) {
                    $Table.style = ($GridTable + ' - ' + $GridAccent) 
                }
                else { $Table.style = $GridTable } 
            } 
            if ($PSBoundParameters.ContainsKey('ListTable')) {
                if ($PSBoundParameters.ContainsKey('ListAccent')) { $Table.style = ($ListTable + ' - ' + $ListAccent) }
                else { $Table.style = $ListTable } 
            }  
            if ($PSBoundParameters.ContainsKey('HeaderRow')) {
                if ($HeaderRow) { $Table.ApplyStyleHeadingRows = $true }
                else { $Table.ApplyStyleHeadingRows = $false } 
            }
            if ($PSBoundParameters.ContainsKey('TotalRow')) {
                if ($TotalRow) { $Table.ApplyStyleLastRow = $true }
                else { $Table.ApplyStyleLastRow = $false } 
            }
            if ($PSBoundParameters.ContainsKey('BandedRow')) {
                if ($BandedRow) { $Table.ApplyStyleRowBands = $true }
                else { $Table.ApplyStyleRowBands = $false} 
            }
            if ($PSBoundParameters.ContainsKey('FirstColumn')) {
                if ($FirstColumn) { $Table.ApplyStyleFirstColumn = $true }
                else { $Table.ApplyStyleFirstColumn = $false } 
            }
            if ($PSBoundParameters.ContainsKey('LastColumn')) {
                if ($LastColumn) { $Table.ApplyStyleLastColumn = $true }
                else { $Table.ApplyStyleLastColumn = $false } 
            }
            if ($PSBoundParameters.ContainsKey('BandedColumn')) {
                if ($BandedColumn) { $Table.ApplyStyleColumnBands = $true }
                else { $Table.ApplyStyleColumnBands = $false } 
            }
            [int]$Row = 1
            [int]$Col = 1
            $PropertyNames = @()
            if ($Object -is [Array]) {[ARRAY]$HeaderNames = $Object[0].psobject.properties | ForEach-Object -Process { $_.Name }} 
            else { [ARRAY]$HeaderNames = $Object.psobject.properties | ForEach-Object -Process { $_.Name } }
   
            if ($RemoveProperties) { $Table.ApplyStyleHeadingRows = $false }
     
            if (!($VerticleTable)) {
                for ($i = 0; $i -le $Columns - 1; $i++) {
                    $PropertyNames += $HeaderNames[$i]
                    if (!$RemoveProperties) {
                        $Table.Cell($Row, $Col).Range.Text = $HeaderNames[$i]
                    }
                    $Col++
                }
                if (!$RemoveProperties)
                { $Row = 2 }
   
                $Object | 
                    ForEach-Object -Process {
                    $Col = 1
                    for ($i = 0; $i -le $Columns - 1; $i++) {      
                        $Table.Cell($Row, $Col).Range.Text = (($_."$($PropertyNames[$i])") -as [System.string])
                        $Col++
                    }    
                    $Row++
                }
            } 
            if ($VerticleTable) {
                for ($i = 0; $i -le $Rows - 1; $i++) {
                    $PropertyNames += $HeaderNames[$i]
                    if (!$RemoveProperties) {
                        $Table.Cell($Row, $Col).Range.Text = $HeaderNames[$i]
                    }
                    $Row++
                }    
                if (!$RemoveProperties) { 
                    $Col = 2 
                }
                $Object | 
                    ForEach-Object -Process {
                    $Row = 1
                    for ($i = 0; $i -le $Rows - 1; $i++) {      
                        $Table.Cell($Row, $Col).Range.Text = (($_."$($PropertyNames[$i])") -as [System.string])
                        $Row++
                    }    
                    $Col++
                }
            }
            $Selection = $WordDocument.application.selection
            $null = $Selection.goto([Microsoft.Office.Interop.Word.WdGoToItem]::wdGoToBookmark, $null, $null, '\EndOfDoc')
            if (!($NoParagraph)) { $WordDocument.Application.Selection.TypeParagraph() }
        }
        catch { Write-Warning -Message "$($MyInvocation.InvocationName) - $($_.exception.message)" }
    }
    End { Write-Verbose -Message "End : $($Myinvocation.InvocationName)" }
    }

function Add-WordTemplate {
  <#
    .SYNOPSIS
    Describe purpose of "Add-WordTemplate" in 1-2 sentences.
 
    .DESCRIPTION
    Add a more complete description of what the function does.
 
    .PARAMETER filename
    Describe parameter -filename.
 
    .PARAMETER WordDocument
    Describe parameter -WordDocument.
 
    .EXAMPLE
    Add-WordTemplate -filename Value -WordDocument Value
    Describe what this call does
 
    .NOTES
    for more examples visit https://shanehoey.github.io/worddoc/
 
    .LINK
    https://shanehoey.github.io/worddoc/docs/add-wordtemplate
 
  #>


    [CmdletBinding()]
    param(
        [Parameter(Mandatory = $false, HelpMessage = 'Word Document or Template to import', Position = 0, ParameterSetName = 'Default')]
        [ValidateScript({ test-Path -Path $_ })] 
        [string]$filename,

        [Parameter(ParameterSetName = 'Default')]
        [Microsoft.Office.Interop.Word.Document]$WordDocument = $Script:WordDocument  
        )   
    Begin {
        Write-Verbose -Message "[Start] *** $($Myinvocation.InvocationName) ***" 
        try { $null = test-WordDocument -WordDocument $WordDocument }
        catch { Write-Warning -Message "$($MyInvocation.InvocationName) - $($_.exception.message)"; break }
        if ($PSBoundParameters.ContainsKey('filename')) {
            $filename = (get-item -path $filename).fullname
            } 
        else { 
            Add-Type -AssemblyName System.windows.forms 
            $OpenFileDialog = New-Object -TypeName System.Windows.Forms.OpenFileDialog
            $OpenFileDialog.initialDirectory =  [Environment]::GetFolderPath('Desktop')
            $OpenFileDialog.filter = 'Word Documents (*.docx)|*.docx|Word Templates (*.dotx)|*.dotx'
            $null = $OpenFileDialog.ShowDialog()
            $filename = $OpenFileDialog.filename
            }
        }
    Process { 
        try { $WordDocument.Application.Selection.InsertFile([ref]($filename)) }
        catch { Write-Warning -Message "$($MyInvocation.InvocationName) - $($_.exception.message)" }
        }
    End { Write-Verbose -Message "End : $($Myinvocation.InvocationName)" }
    }

function Add-WordText {
  <#
    .SYNOPSIS
    Adds text to MS Word Document.
 
    .DESCRIPTION
    Adds text to MS Word Document.
 
    .PARAMETER text
    Text to add to word Document
 
    .PARAMETER WdColor
    Color of Text
 
    .PARAMETER WDBuiltinStyle
    Builtin Stype to use
 
    .PARAMETER WordDocument
    WordDocument Object
 
    .EXAMPLE
 
    Add-WordText -text "Heading 1" -WdColor Value -WDBuiltinStyle Value -WordDocument Value
     
    Adds text to document
 
    .EXAMPLE
 
    Add-WordText -text "Heading 1" -WdColor Value -WDBuiltinStyle Value -WordDocument Value
     
    Adds text to document
 
    .NOTES
    for more examples visit https://shanehoey.github.io/worddoc/
 
    .LINK
    https://shanehoey.github.io/worddoc/docs/add-wordtext
 
  #>


    [CmdletBinding()]
    param(
        [Parameter(Position = 0, Mandatory = $true )] 
        [String]$text,
    
        [Microsoft.Office.Interop.Word.WdColor]$WdColor = 'wdColorAutomatic',
    
        [Microsoft.Office.Interop.Word.WdBuiltinStyle]$WDBuiltinStyle = 'wdStyleDefaultParagraphFont',
    
        [Microsoft.Office.Interop.Word.Document]$WordDocument = $Script:WordDocument
    )
    Begin {
        Write-Verbose -Message "[Start] *** $($Myinvocation.InvocationName) ***" 
        try { $null  = test-WordDocument -WordDocument $WordDocument }
        catch { Write-Warning -Message "$($MyInvocation.InvocationName) - $($_.exception.message)"; break }
    }
    Process { 
        try {
            if ($PSBoundParameters.ContainsKey('WDBuiltinStyle')) { Write-verbose -Message "$WDBuiltinStyle"; $WordDocument.application.selection.Style = $WDBuiltinStyle }
            if ($PSBoundParameters.ContainsKey('WdColor')) { Write-verbose -Message "$wdcolor"; $WordDocument.Application.Selection.font.Color = $WdColor.value__ }
            $WordDocument.Application.Selection.TypeText("$($text)")    
            $WordDocument.Application.Selection.TypeParagraph() 
            $WordDocument.application.selection.Style = [Microsoft.Office.Interop.Word.WdBuiltinStyle]'wdStyleNormal'
        }
        catch {
            Write-Warning -Message "$($MyInvocation.InvocationName) - $($_.exception.message)"
        }
    }
    End { 
        Write-Verbose -Message "End : $($Myinvocation.InvocationName)" 
    }
    }

function Add-WordTOC {
  <#
    .SYNOPSIS
    Describe purpose of "Add-WordTOC" in 1-2 sentences.
 
    .DESCRIPTION
    Add a more complete description of what the function does.
 
    .PARAMETER WordInstance
    Describe parameter -WordInstance.
 
    .PARAMETER WordDocument
    Describe parameter -WordDocument.
 
    .EXAMPLE
    Add-WordTOC -WordInstance Value -WordDocument Value
    Describe what this call does
 
    .NOTES
    for more examples visit https://shanehoey.github.io/worddoc/
 
    .LINK
    https://shanehoey.github.io/worddoc/docs/add-wordtoc
 
  #>



    [CmdletBinding()]  
    param (
        #Todo cast type instead ie [Microsoft.Office.Interop.Word.Application]$WordInstance but does not work
        [ValidateScript( {test-wordinstance -WordInstance $_})]
        [Microsoft.Office.Interop.Word.Application]$WordInstance = $Script:WordInstance,
  
        [ValidateScript( {test-WordDocument -WordDocument $_})]
        [Microsoft.Office.Interop.Word.Document]$WordDocument = $Script:WordDocument,
        
        [ValidateRange(0,5)]
        [Int]$Tableader = 0,

        [ValidateRange(0,5)]
        [Int]$IncludePageNumbers = $TRUE
    )
    Begin { 
        Write-Verbose -Message "[Start] *** $($Myinvocation.InvocationName) ***"
        try {  $null = test-wordinstance -WordInstance $wordinstance 
               $null = test-WordDocument -WordDocument $WordDocument }
        catch { Write-Warning -Message "$($MyInvocation.InvocationName) - $($_.exception.message)"; break }
    }
    Process {  
        try {
            $toc = $WordDocument.TablesOfContents.Add($WordInstance.selection.Range)
            $toc.Tableader = $Tableader
            $toc.IncludePageNumbers = $IncludePageNumbers
            $WordDocument.Application.Selection.TypeParagraph()
            $null = $WordDocument.Application.Selection.goto([Microsoft.Office.Interop.Word.WdGoToItem]::wdGoToBookmark, $null, $null, '\EndOfDoc')
        }
        catch {
            Write-Warning -Message "$($MyInvocation.InvocationName) - $($_.exception.message)"
        }
    }
    End {
        Write-Verbose -Message "End : $($Myinvocation.InvocationName)" 
    }
    }

function Update-WordTOC {
  <#
    .SYNOPSIS
    Describe purpose of "Update-WordTOC" in 1-2 sentences.
 
    .DESCRIPTION
    Add a more complete description of what the function does.
 
    .PARAMETER WordDocument
    Describe parameter -WordDocument.
 
    .EXAMPLE
    Update-WordTOC -WordDocument Value
    Describe what this call does
 
    .NOTES
    for more examples visit https://shanehoey.github.io/worddoc/
 
    .LINK
    https://shanehoey.github.io/worddoc/docs/update-wordtoc
 
  #>



    [CmdletBinding()]   
    param (
        [Microsoft.Office.Interop.Word.Document]$WordDocument = $Script:WordDocument
    )
    Begin {
        Write-Verbose -Message "Start : $($Myinvocation.InvocationName)" 
        try { $null = test-WordDocument -WordDocument $WordDocument }
        catch { Write-Warning -Message "$($MyInvocation.InvocationName) - $($_.exception.message)"; break }
    }
    Process { 
        try { $null =  $WordDocument.Fields | ForEach-Object -Process { $_.Update() } }
        catch { Write-Warning -Message "$($MyInvocation.InvocationName) - $($_.exception.message)" }
    }
    End { Write-Verbose -Message "End : $($Myinvocation.InvocationName)" }
    }

function Get-WordBuiltinStyle {
  <#
    .SYNOPSIS
    Describe purpose of "Get-WordBuiltinStyle" in 1-2 sentences.
 
    .DESCRIPTION
    Add a more complete description of what the function does.
 
    .EXAMPLE
    Get-WordBuiltinStyle
    Describe what this call does
 
    .NOTES
    for more examples visit https://shanehoey.github.io/worddoc/
 
    .LINK
    https://shanehoey.github.io/worddoc/docs/get-wordbuiltinstyle
 
  #>


    [CmdletBinding()]
    param()
    Begin { Write-Verbose -Message "[Start] *** $($Myinvocation.InvocationName) ***" }
    Process { 
        try { [Enum]::GetNames([Microsoft.Office.Interop.Word.WdBuiltinStyle]) | ForEach-Object -Process {[pscustomobject]@{ Style = $_ } } }
        catch { Write-Warning -Message "$($MyInvocation.InvocationName) - $($_.exception.message)" } }
    End { Write-Verbose -Message "End : $($Myinvocation.InvocationName)" }
    }

function Get-WordWdTableFormat {
  <#
    .SYNOPSIS
    Describe purpose of "Get-WordWdTableFormat" in 1-2 sentences.
 
    .DESCRIPTION
    Add a more complete description of what the function does.
 
    .EXAMPLE
    Get-WordWdTableFormat
    Describe what this call does
 
    .NOTES
    for more examples visit https://shanehoey.github.io/worddoc/
 
    .LINK
    https://shanehoey.github.io/worddoc/docs/get-wordwdtableformat
 
  #>



    [CmdletBinding()]
    param()

    Begin { Write-Verbose -Message "[Start] *** $($Myinvocation.InvocationName) ***" }
    Process { 
        try { [Enum]::GetNames([Microsoft.Office.Interop.Word.WdTableFormat]) | ForEach-Object -Process {[pscustomobject]@{ Style = $_ } } }
        catch { Write-Warning -Message "$($MyInvocation.InvocationName) - $($_.exception.message)" }
    }
    End { Write-Verbose -Message "End : $($Myinvocation.InvocationName)" }
    }

function Set-WordBuiltInProperty {
  <#
    .SYNOPSIS
    Describe purpose of "Set-WordBuiltInProperty" in 1-2 sentences.
 
    .DESCRIPTION
    Add a more complete description of what the function does.
 
    .PARAMETER WdBuiltInProperty
    Describe parameter -WdBuiltInProperty.
 
    .PARAMETER text
    Describe parameter -text.
 
    .PARAMETER WordDocument
    Describe parameter -WordDocument.
 
    .EXAMPLE
    Set-WordBuiltInProperty -WdBuiltInProperty Value -text Value -WordDocument Value
    Describe what this call does
 
    .NOTES
    for more examples visit https://shanehoey.github.io/worddoc/
 
    .LINK
    https://shanehoey.github.io/worddoc/docs/set-wordbuiltinproperty
 
  #>



    [CmdletBinding()]
    param(
    
        [Parameter(Position = 0, Mandatory = $true)] 
        [Microsoft.Office.Interop.Word.WdBuiltInProperty]$WdBuiltInProperty,
    
        [Parameter(Position = 1, mandatory = $true)] 
        [String]$text,
    
        [Microsoft.Office.Interop.Word.Document]$WordDocument = $Script:WordDocument
    )
    Begin { 
        Write-Verbose -Message "Start : $($Myinvocation.InvocationName)" 
        try { $null = test-WordDocument -WordDocument $WordDocument }
        catch { Write-Warning -Message "$($MyInvocation.InvocationName) - $($_.exception.message)"; break }
    }
    Process { 
        try { 
            Write-Verbose -Message $WdBuiltInProperty
            $WordDocument.BuiltInDocumentProperties([Microsoft.Office.Interop.Word.WdBuiltInProperty]$WdBuiltInProperty) = $text
        }
        catch {
            Write-Warning -Message "$($MyInvocation.InvocationName) - $($_.exception.message)"
        }
    }
    End { 
        Write-Verbose -Message "End : $($Myinvocation.InvocationName)" 
    }
    }

function Set-WordOrientation {
  <#
    .SYNOPSIS
    Describe purpose of "Set-WordOrientation" in 1-2 sentences.
 
    .DESCRIPTION
    Add a more complete description of what the function does.
 
    .PARAMETER Orientation
    Describe parameter -Orientation.
 
    .PARAMETER WordInstance
    Describe parameter -WordInstance.
 
    .EXAMPLE
    Set-WordOrientation -Orientation Value -WordInstance Value
    Describe what this call does
 
    .NOTES
    for more examples visit https://shanehoey.github.io/worddoc/
 
    .LINK
    https://shanehoey.github.io/worddoc/docs/set-wordorientation
 
  #>



    [CmdletBinding()]
    param(
        [Parameter(Position = 0, HelpMessage = 'Orientation of page', Mandatory = $true)] 
        [ValidateSet('Portrait', 'Landscape')]  
        [string]$Orientation,
  
        [Microsoft.Office.Interop.Word.Application]$WordInstance = $Script:WordInstance
            
    )
    Begin {
        Write-Verbose -Message "[Start] *** $($Myinvocation.InvocationName) ***"
        try {  $null = test-wordinstance -WordInstance $wordinstance }
        catch { Write-Warning -Message "$($MyInvocation.InvocationName) - $($_.exception.message)"; break }
    }
    Process { 
        try {
            switch ($Orientation) {
                'Portrait' { $WordInstance.Selection.PageSetup.Orientation = 0 }
                'Landscape' { $WordInstance.Selection.PageSetup.Orientation = 1 }    
            }
        }
        catch { Write-Warning -Message "$($MyInvocation.InvocationName) - $($_.exception.message)" }
    }
    End { Write-Verbose -Message "End : $($Myinvocation.InvocationName)" }
    }

# SIG # Begin signature block
# MIINCgYJKoZIhvcNAQcCoIIM+zCCDPcCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUAEO4/Yz3p2R956pKaGdJWUXI
# F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