Article View: adobe.scripting.indesign
Article #18055Re: Moving thru a Doc (VB)
From: Olav Kvern
Date: Fri, 25 Apr 2003 21:19
Date: Fri, 25 Apr 2003 21:19
62 lines
3365 bytes
3365 bytes
Iolaire--
John wants to change the first baseline offset calculation method, not set the leading of the paragraph. What he's looking for is a property of the TextFramePreferences object.
John--
Try something like this:
Rem Change the first baseline offset method for all text frames
Set myInDesign = CreateObject("InDesign.Application.2.0")
Set myDocument = myInDesign.ActiveDocument
Rem The following will catch all text frames that are not in groups
Rem or inside other items (i.e., inline text frames and text frames
Rem pasted inside other page items.
For myCounter = 1 To myDocument.TextFrames.Count
Set myTextFrame = myDocument.TextFrames.Item(myCounter)
Set myTextFramePreferences = myTextFrame.TextFramePreferences
myTextFramePreferences.FirstBaselineOffset = idAscent
Next
Rem To catch the text frames on the master pages...
For myCounter = 1 To myDocument.MasterSpreads.Count
Set myMasterSpread = myDocument.MasterSpreads.Item(myCounter)
For myTextFrameCounter = 1 To myMasterSpread.TextFrames.Count
Set myTextFrame = myDocument.TextFrames.Item(myTextFrameCounter)
Set myTextFramePreferences = myTextFrame.TextFramePreferences
myTextFramePreferences.FirstBaselineOffset = idAscent
Next
Next
In my opinion, idLeading is a much better way to set the first line baseline position. If you use idAscent, you can never really know where the first baseline will appear, as the size of the characters/inline frames in the first line of text will set the distance from the top of the text frame. The only reason I can see to use idAscent is to make converted PageMaker and QuarkXPress documents look more like they did in those applications (QuarkXPress first baseline calculation methods are *always* inaccurate; PageMaker's can be if you are not using the Baseline leading method).
To find each inline graphic, try something like this:
Rem FindInlinesAndSetFitOption
Dim myInDesign As InDesign.Application
Set myInDesign = CreateObject("InDesign.Application.2.0")
myInDesign.FindPreferences = idNothing
myInDesign.ChangePreferences = idNothing
Set myDocument = myInDesign.ActiveDocument
Rem Use the metacharacter ^g to find inline frames.
Set myFoundItems = myDocument.Search("^g")
For myCounter = 1 To myFoundItems.Count
Set myItem = myFoundItems.Item(myCounter)
Set myFrame = myItem.Inlines.Item(1)
If myFrame.ContentType = idGraphic Then
myFrame.Fit idFrameToContent
End If
Next
Thanks,
Ole
Technical Details
Message-ID:
<1de8d969.2@WebX.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-08!supernews.com!newshosting.com!news-xfer2.atl.newshosting.com!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.tpinternet.pl!newsfeed01.sul.t-online.de!t-online.de!WebXReferences:
<1de8d969.-1@WebX.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,1947ddd4f96df251 X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2003-04-25 14:37:48 PST From: "Olav Kvern" <okvern@adobe.com> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-08!supernews.com!newshosting.com!news-xfer2.atl.newshosting.com!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.tpinternet.pl!newsfeed01.sul.t-online.de!t-online.de!WebX Newsgroups: adobe.scripting.indesign Subject: Re: Moving thru a Doc (VB) Message-ID: <1de8d969.2@WebX.la2eafNXanI> Date: Fri, 25 Apr 2003 14:19:21 -0700 References: <1de8d969.-1@WebX.la2eafNXanI> Lines: 65 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit