Powershell and Word 2010

This topic contains 0 replies, has 1 voice, and was last updated by  Forums Archives 5 years, 7 months ago.

  • Author
    Posts
  • #5026

    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

You must be logged in to reply to this topic.