Article View: adobe.scripting.indesign
Article #16342Re: [VB] Working with GeometricBounds
From: Iolaire McFadden
Date: Thu, 25 Sep 2003 18:05
Date: Thu, 25 Sep 2003 18:05
27 lines
1832 bytes
1832 bytes
Good example, so I create a blank document, add 1 text frame which doesn't reach from margin to margin, run the following and it makes the text frame span from margin to margin. That is what you want?
Sub testing()
Set myInDesign = CreateObject("InDesign.Application.2.0")
Set myDocument = myInDesign.ActiveDocument
' here I just pick a page to measure = 1, you probably want to use your current page
Set my_page_items = myDocument.Pages.Item(1).AllPageItems
' here I set DocCDN to page item = 1, you want to use your object to change
Set DocCDN = my_page_items.Item(1)
' get the margin info
MarginB = myDocument.Pages.Item(1).MarginPreferences.MarginBottom
MarginL = myDocument.Pages.Item(1).MarginPreferences.MarginLeft
' get bounds of page = 1
myNew = myDocument.Pages.Item(1).bounds
' get your text frame bounds
myBounds = DocCDN.GeometricBounds
' subtract Margins from page bounds
myBounds(1) = myNew(1) + MarginB ' left margin have to add
myBounds(3) = myNew(3) - MarginL ' right margin
' size your frame
DocCDN.GeometricBounds = myBounds
End Sub
iolaire
Technical Details
Message-ID:
<2ccd88b5.8@webx.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-09!supernews.com!newsfeed.news2me.com!newsfeed.freenet.de!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!webxReferences:
<2ccd88b5.-1@webx.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,34141f6e382b2aea X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2003-09-25 11:08:14 PST From: "Iolaire McFadden" <imcfadden@costar.com> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-09!supernews.com!newsfeed.news2me.com!newsfeed.freenet.de!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!webx Newsgroups: adobe.scripting.indesign Subject: Re: [VB] Working with GeometricBounds Message-ID: <2ccd88b5.8@webx.la2eafNXanI> Date: Thu, 25 Sep 2003 11:05:34 -0700 References: <2ccd88b5.-1@webx.la2eafNXanI> Lines: 31 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit