Windows Scripting
  Home arrow Windows Scripting arrow Page 4 - Reading and Printing Word Documents in WSH
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Mobile Linux 
App Generation ROI 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
WINDOWS SCRIPTING

Reading and Printing Word Documents in WSH
By: Nilpo
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 3
    2008-10-13

    Table of Contents:
  • Reading and Printing Word Documents in WSH
  • Printing Word Documents
  • Advanced Printing Options
  • Page Setup options
  • Printing Page Ranges and more

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Reading and Printing Word Documents in WSH - Page Setup options


    (Page 4 of 5 )

    Select Properties of the PageSetup object

    BookFoldPrinting

    True for Microsoft Word to print a document in a series of booklets so the printed pages can be folded and read as a book. Read/write Boolean.

    BookFoldPrintingSheets

    Returns or sets a Long which represents the number of pages for each booklet. Read/write Boolean.

    BookFoldRevPrinting

    True for Microsoft Word to reverse the printing order for book fold printing of bidirectional or Asian language documents. Read/write Boolean.

    BottomMargin

    Returns or sets the distance (in points) between the bottom edge of the page and the bottom boundary of the body text. Read/write Single.

    DifferentFirstPageHeaderFooter

    True if a different header or footer is used on the first page. Can be True, False, or wdUndefined. Read/write Long.

    FirstPageTray

    Returns or sets the paper tray to use for the first page of a document or section. Read/write WdPaperTray.

    FooterDistance

    Returns or sets the distance (in points) between the footer and the bottom of the page. Read/write Single.

    Gutter

    Returns or sets the amount (in points) of extra margin space added to each page in a document or section for binding. Read/write Single.

    GutterPos

    Returns or sets on which side the gutter appears in a document. Read/write WdGutterStyle.

    GutterStyle

    Returns or sets whether Microsoft Word uses gutters for the current document based on a right-to-left language or a left-to-right language. Read/write WdGutterStyleOld.

    HeaderDistance

    Returns or sets the distance (in points) between the header and the top of the page. Read/write Single.

    LayoutMode

    Returns or sets the layout mode for the current document. Read/write WdLayoutMode.

    LeftMargin

    Returns or sets the distance (in points) between the left edge of the page and the left boundary of the body text. Read/write Single.

    Orientation

    Returns or sets the orientation of the page. Read/write WdOrientation.

    OtherPagesTray

    Returns or sets the paper tray to be used for all but the first page of a document or section. Read/write WdPaperTray.

    PageHeight

    Returns or sets the height of the page in points. Read/write Single.

    PageWidth

    Returns or sets the width of the page in points. Read/write Single.

    PaperSize

    Returns or sets the paper size. Read/write WdPaperSize.

    RightMargin

    Returns or sets the distance (in points) between the right edge of the page and the right boundary of the body text. Read/write Single.

    TopMargin

    Returns or sets the distance (in points) between the top edge of the page and the top boundary of the body text. Read/write Single.

    TwoPagesOnOne

    True if Microsoft Word prints the specified document two pages per sheet. Read/write Boolean.

    VerticalAlignment

    Returns or sets the vertical alignment of text on each page in a document or section. Read/write WdVerticalAlignment.

    The PageSetup object provides access to the settings in Word’s Page Setup… dialog box.  These settings are used to control page layouts, margins, and more.  They can be used in conjunction with the Options object’s properties to create different print effects.

    Const wdPaperLegal = 4

     

    objWord.ActiveDocument.PageSetup.LeftMargin = 72

    objWord.ActiveDocument.PageSetup.RightMargin = 72

    objWord.ActiveDocument.PageSetup.PaperSize = wdPaperLegal

    In this example, I’m manually setting the left and right margins to one inch (72 points) and changing the layout to use legal size paper.  For more information on the PageSetup object’s properties and associated constant values, refer to the MSDN documentation here.

    The PageSetup object can be used to set properties for the entire document, specific pages, or even specific sections!

    More Windows Scripting Articles
    More By Nilpo


       · In the second installment of this series, I show readers some of the more advanced...
     

    WINDOWS SCRIPTING ARTICLES

    - Working With Arrays in VBScript
    - Compressed Folders in WSH
    - Using .NET Interops in VBScript
    - Nilpo`s Scripting Secrets, Vol I
    - Database operations using Silverlight 2.0 WC...
    - Modifying XML Files in WSH
    - Reading XML Files in WSH
    - Visual Basic 2005 XML Programming Using XML ...
    - Creating an XML Document in WSH
    - Introducing Two-Way Data Binding using Silve...
    - Silverlight 2.0 Application Development with...
    - Burning Multisession CDs with IMAPI2 in WSH
    - Creating a Silverlight 2.0 Application that ...
    - Burning CDs with the IMAPI2 Control
    - Burning CDs in Windows XP with WSH

     
    Best Practices for Windows Vista Migration Presentation
    Dell and Microsoft recently held a series of face-to-face seminars entitled, &qu....

     
    Creating a Culture for Code Reuse
    If you oversee development teams you know that like it or not proprietary and ex....

     
    Keys to Web Application Acceleration: Advances in Delivery Systems
    Accelerate Web apps by up to 5x. Ensure significantly faster access to the Web a....

     
    Optimizing Application Monitoring
    Tired of finding out from your customers that you're offline? This white paper e....

     
    Solaris to Solaris Migration -- Migrating applications from Sun SPARC to Dell PowerEdge R900
    This comprehensive Migration Guide reviews the approach that Principled Technolo....

     




    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
    Stay green...Green IT