Re: Start Word with landscape oriented document
From: m.littlewood <matt_at_mrlittlewod.freeserve.co.uk>
Date: Mon, 31 Mar 2003 22:41:08 +0100
Message-ID: <uC2ia.314$nQ4.29_at_news-binary.blueyonder.co.uk>
Date: Mon, 31 Mar 2003 22:41:08 +0100
Message-ID: <uC2ia.314$nQ4.29_at_news-binary.blueyonder.co.uk>
The easiest way is to define the named document as landscape
(i.e. save the 'template' with a landscape orientation). Whenever this document
is opened (either thru Word, or Oracle), you should find that it keeps its
orientation.
Alternatively, use OLE2 built-in in Forms to manipulate the
WORD object at runtime.
To try to understand how to do this, use MS Word to record a
macro, then change the document's properties as you wish. Then examine the
resulting Word Basic commands in the macro, to help you. For example, you
should find that the macro will look something like :
With
ActiveDocument.PageSetup
.LineNumbering.Active = False
.Orientation = wdOrientLandscape
.TopMargin = CentimetersToPoints(3.17)
.BottomMargin = CentimetersToPoints(3.17)
.LeftMargin = CentimetersToPoints(2.54)
.RightMargin = CentimetersToPoints(2.54)
.Gutter = CentimetersToPoints(0)
.HeaderDistance = CentimetersToPoints(1.25)
.FooterDistance = CentimetersToPoints(1.25)
.PageWidth = CentimetersToPoints(29.7)
.PageHeight = CentimetersToPoints(21)
.FirstPageTray = wdPrinterDefaultBin
.OtherPagesTray = wdPrinterDefaultBin
.SectionStart = wdSectionNewPage
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.VerticalAlignment = wdAlignVerticalTop
.SuppressEndnotes = False
.MirrorMargins = False
End With
.LineNumbering.Active = False
.Orientation = wdOrientLandscape
.TopMargin = CentimetersToPoints(3.17)
.BottomMargin = CentimetersToPoints(3.17)
.LeftMargin = CentimetersToPoints(2.54)
.RightMargin = CentimetersToPoints(2.54)
.Gutter = CentimetersToPoints(0)
.HeaderDistance = CentimetersToPoints(1.25)
.FooterDistance = CentimetersToPoints(1.25)
.PageWidth = CentimetersToPoints(29.7)
.PageHeight = CentimetersToPoints(21)
.FirstPageTray = wdPrinterDefaultBin
.OtherPagesTray = wdPrinterDefaultBin
.SectionStart = wdSectionNewPage
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.VerticalAlignment = wdAlignVerticalTop
.SuppressEndnotes = False
.MirrorMargins = False
End With
the relevant property in this case is in bold
above.
Therefore you need to set the ORIENTATION property on the
'active document.pagesetup' object to a constant value 'wdOrientLandscape' - if
you use the Object Browser in Visual Basic / Word Basic you will find that this
equates to '1'.
In other words, you need to get a handle on the Pagesetup
object, by getting the document object's pagesetup object.
Once you've got the PageSetup object, you use
OLE2.SET_PROPERTY function to set Orientation property to 1.
You will find a white paper on manipulating OLE2 objects (such
as Ms Word documents) in the OTN.
:)
Received on Mon Mar 31 2003 - 23:41:08 CEST