🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #18272

Re: Creating a page and a table

#18272
From: Olav Kvern
Date: Fri, 11 Apr 2003 18:59
67 lines
3548 bytes
Gerhard--

You don't need to change the PathPoints of the text frame. Instead, you can change the GeometricBounds or VisibleBounds of the frame. These properties are both arrays in y1, x1, y2, x2 order (where y1 = top, x1 = left, y2 = bottom, and x2 = right). Here's an example that shows how to change the size of a text frame:



Dim myInDesign As InDesign.Application 
Set myInDesign = CreateObject("InDesign.Application.2.0") 
Set myDocument = myInDesign.Documents.Add 
Rem Because you'll probably want to move the object from one page 
Rem to the same location on another page, let's make sure that 
Rem the measurement origin is located in the same place on all pages. 
myDocument.ViewPreferences.RulerOrigin = idPageOrigin 
Rem Create a new text frame. 
Set myTextFrame = myDocument.Pages.Item(1).TextFrames.Add 
Rem Always move objects slightly after creation to clear up page "ownership". 
Rem If the stroke of the object *touches* the page to the left, ID thinks that 
Rem the object belongs to that page, and all your object references will be 
Rem invalid. In this case, we don't really have to do it, but it's a good practice. 
Rem This is a relative move, so we omit the MoveTo (i.e., absolute) parameter. 
myTextFrame.Move , Array("3p", "3p") 
Rem Resize the text frame (I've used measurement overrides; you probably don't have to). 
myBounds = Array("6p", "6p", "18p", "18p") 
myTextFrame.GeometricBounds = myBounds 




Here's an example that shows how to set the bounds of a text frame to the margins of the page.



Private Sub Command1_Click() 
Dim myInDesign As InDesign.Application 
Set myInDesign = CreateObject("InDesign.Application.2.0") 
Set myDocument = myInDesign.Documents.Add 
myDocument.ViewPreferences.RulerOrigin = idPageOrigin 
Set myTextFrame = myDocument.Pages.Item(1).TextFrames.Add 
myTextFrame.Move , Array("3p", "3p") 
myTextFrame.GeometricBounds = myGetBounds(myDocument.Pages.Item(1), myDocument) 
End Sub 
Private Function myGetBounds(myPage, myDocument) 
    myPageHeight = myDocument.DocumentPreferences.PageHeight 
    myPageWidth = myDocument.DocumentPreferences.PageWidth 
    myX1 = myPage.MarginPreferences.MarginLeft 
    myY1 = myPage.MarginPreferences.MarginTop 
    myY2 = myPageHeight - myPage.MarginPreferences.MarginBottom 
    myX2 = myPageWidth - myPage.MarginPreferences.MarginRight 
    myGetBounds = Array(myY1, myX1, myY2, myX2) 
End Function 




If you wanted to use PathPoints, the PathPoint property you use to set the location of a PathPoint is PathPoint.Anchor--which is a coordinate array in x, y order. To move a path point to a specific location, do something like this:



Given a PathPoint "myPathPoint" 
myPathPoint.Anchor = Array(18, 22) 




Thanks,

Ole
Technical Details
Message-ID: <1de8b3e4.0@WebX.la2eafNXanI>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!iad-peer.news.verio.net!news.verio.net!news.maxwell.syr.edu!newscore.univie.ac.at!newsfeed01.sul.t-online.de!t-online.de!WebX
References: <1de8b3e4.-1@WebX.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,2c7f2031a38a428b
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2003-04-11 12:08:36 PST
From: "Olav Kvern" <okvern@adobe.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!iad-peer.news.verio.net!news.verio.net!news.maxwell.syr.edu!newscore.univie.ac.at!newsfeed01.sul.t-online.de!t-online.de!WebX
Newsgroups: adobe.scripting.indesign
Subject: Re: Creating a page and a table
Message-ID: <1de8b3e4.0@WebX.la2eafNXanI>
Date: Fri, 11 Apr 2003 11:59:25 -0700
References: <1de8b3e4.-1@WebX.la2eafNXanI>
Lines: 70
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit