Skip to content

Instantly share code, notes, and snippets.

@ian-moore
Last active March 28, 2016 15:41
Show Gist options
  • Save ian-moore/f024b66b827ffb104dc5 to your computer and use it in GitHub Desktop.
Save ian-moore/f024b66b827ffb104dc5 to your computer and use it in GitHub Desktop.
[xml]$xmlFile = get-content 'C:\Users\imoore\Desktop\SomeCompany.SomeProject.xml'
$rootNamespace = 'SomeCompany.SomeProject.'
$word = New-Object -ComObject Word.Application
$document = $word.Documents.Add()
$selection = $word.Selection
$selection.Style = 'Heading 1'
$selection.TypeText('Project Plugins')
$selection.TypeParagraph()
$xmlFile.doc.members.member |
? { $_.name.StartsWith('T:') } |
% { [pscustomobject]@{'name'=$_.name.Replace("T:$rootNamespace", ''); 'summary'=$_.summary;} } |
sort name |
? { $_.name.Contains("Plugin") } |
% {
$selection.Style = 'Heading 2'
$selection.TypeText($_.name)
$selection.TypeParagraph()
$selection.Style = 'Normal'
$selection.TypeText($_.summary.Trim())
$selection.TypeParagraph()
}
$docFile = 'C:\Users\imoore\Desktop\PluginTypes.docx'
$saveFormat = [Enum]::GetNames([Microsoft.Office.Interop.Word.WdSaveFormat])
$document.SaveAs([ref]$docFile,[ref]$saveFormat::wdFormatDocument)
$document.Close()
$word.Application.Quit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment