Author Posts

January 1, 2012 at 12:00 am

by davehook at 2012-08-21 03:49:16

Hi,
Im kinda new to powershell and need your help! Im using powershell to create a MS Word document and output an SQL query into a table in that document. The first question is how do i set the page orientation to Landscape and, for the table, how do i set the table to Autofit to window?

Many thanks for your time

by surveyor at 2012-08-21 10:15:02

Hi,
you can use this to switch to landscape
[script=powershell]$Word = New-Object -ComObject Word.Application
$Word.Visible = $true
$Word.Documents.Add("Normal",$false,0,$true)
$Word.Selection.PageSetup.Orientation = [Microsoft.Office.Interop.Word.WdOrientation]]

by davehook at 2012-08-22 02:03:09

Thanks, that worked for the orientation

by surveyor at 2012-08-22 03:23:33

Can you explain, what you mean with autofit to windows for the table?

by davehook at 2012-08-22 06:44:50

Basically i want the table to be 100% width of the page

by RichLec at 2012-08-23 09:54:16

This might give you a little help.. http://blogs.technet.com/b/heyscripting ... fonts.aspx