🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #20982

Re: Draw rectangle around a paragraph

#20982
From: Olav Kvern
Date: Wed, 22 May 2002 17:26
9 lines
2288 bytes
jurami1-- 

Here's that example I promised (this is in VB, let me know if you need/prefer the AppleScript version): 

Rem Quick (and dirty) example of using a table to put a box around a paragraph. Dim myInDesign As InDesign.Application Set myInDesign = CreateObject("InDesign.Application.2.0") Set myDocument = myInDesign.Documents.Add Set myTextFrame = myDocument.Pages.Item(1).TextFrames.Add myTextFrame.GeometricBounds = Array("6p", "6p", "24p", "18p") myString = "First paragraph." & vbCr & "Note: This is the second paragraph. We want to put it in a box. Using a single-cell table is a reasonable way to do this great and good thing." & vbCr myString = myString & "This is the third paragraph. Isn't writing sample text fun?" & vbcr myTextFrame.Contents = myString Set myParagraph = myTextFrame.Paragraphs.Item(2) Set myTable = myParagraph.Tables.Add Rem Remove the table's space before and space after (it's easier to use paragraph spacing). myTable.SpaceAfter = 0 myTable.SpaceBefore = 0 Rem Format the table's stroke. myTable.LeftBorderStrokeWeight = 0.25 myTable.RightBorderStrokeWeight = 0.25 myTable.TopBorderStrokeWeight = 0.25 myTable.BottomBorderStrokeWeight = 0.25 Rem Apply a tint to the fill of the table. Set myCell = myTable.Cells.Item(1) myCell.FillColor = myDocument.Colors.Item("Black") myCell.FillTint = 20 Rem Add some space before/after to the paragraph format. myParagraph.SpaceAfter = "1p" myParagraph.SpaceBefore = "1p"  

Thanks, 

Ole
Technical Details
Message-ID: <ef8ad15.2@WebX.aaQKaf7vad4>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!supernews.com!peer1-sjc1.usenetserver.com!usenetserver.com!newsfeed1.cidera.com!Cidera!news.maxwell.syr.edu!opentransit.net!newsfeed.icl.net!newsfeed.freenet.de!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebX
References: <ef8ad15.-1@WebX.aaQKaf7vad4>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,b1c5238e6a1b1ab5
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2002-05-22 10:37:45 PST
From: "Olav Kvern" <okvern@adobe.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!supernews.com!peer1-sjc1.usenetserver.com!usenetserver.com!newsfeed1.cidera.com!Cidera!news.maxwell.syr.edu!opentransit.net!newsfeed.icl.net!newsfeed.freenet.de!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebX
Newsgroups: adobe.scripting.indesign
Subject: Re: Draw rectangle around a paragraph
Message-ID: <ef8ad15.2@WebX.aaQKaf7vad4>
Date: Wed, 22 May 2002 10:26:55 -0700
References: <ef8ad15.-1@WebX.aaQKaf7vad4>
Lines: 41
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit