Article View: adobe.scripting.indesign
Article #20716Re: Vertical tabulation
From: Olav Kvern
Date: Tue, 11 Jun 2002 19:51
Date: Tue, 11 Jun 2002 19:51
15 lines
4018 bytes
4018 bytes
Gang--
Here's an example that (relatively quickly) creates side-by-side paragraphs as a table.
Private Sub myMakeTable() Dim myInDesign As InDesign.Application Set myInDesign = CreateObject("InDesign.Application.2.0") Rem Create a dummy document Set myDocument = myInDesign.Documents.Add Set myPage = myDocument.Pages.Item(1) Set myTextFrame = myPage.TextFrames.Add myX1 = myPage.MarginPreferences.MarginLeft myY1 = myPage.MarginPreferences.MarginTop myX2 = myDocument.DocumentPreferences.PageWidth - myPage.MarginPreferences.MarginRight myY2 = myDocument.DocumentPreferences.PageHeight - myPage.MarginPreferences.MarginBottom myTextFrame.GeometricBounds = Array(myY1, myX1, myY2, myX2) myTextFrame.TextContents = idPlaceholderText myTextFrame.Paragraphs.Item(2).InsertionPoints.Item(1).TextContents = "Table Cell 1. " Rem For the sake of this example, truncate the second paragraph (if necessary) If myTextFrame.Paragraphs.Item(2).Characters.Count > 256 Then myTextFrame.Paragraphs.Item(2).InsertionPoints.Item(256).TextContents = vbCr End If myTextFrame.Paragraphs.Item(3).InsertionPoints.Item(1).TextContents = "Table Cell 2. " Rem For the sake of this example, truncate the third paragraph (if necessary) If myTextFrame.Paragraphs.Item(3).Characters.Count > 256 Then myTextFrame.Paragraphs.Item(3).InsertionPoints.Item(256).TextContents = vbCr End If Rem Tell the second paragraph to make the table. Set myTable = myTextFrame.Paragraphs.Item(2).Tables.Add Rem Add a column. myTable.Columns.Add Rem Resize the table. myTable.Width = myDocument.DocumentPreferences.PageWidth - (myX1 + myPage.MarginPreferences.MarginRight) Rem Move the second paragraph into the table myTextFrame.Paragraphs.Item(3).Move idAtBeginning, myTable.Cells.Item(2) Rem Remove the default table strokes, spacing. myRemoveTableFormatting myTable End Sub
Private Sub myRemoveTableFormatting(myTable As InDesign.Table) Dim myRow As InDesign.Row myTable.BottomBorderStrokeWeight = 0 myTable.EndColumnStrokeWeight = 0 myTable.EndRowStrokeWeight = 0 myTable.LeftBorderStrokeWeight = 0 myTable.RightBorderStrokeWeight = 0 myTable.StartColumnStrokeWeight = 0 myTable.StartRowStrokeWeight = 0 myTable.TopBorderStrokeWeight = 0 myTable.SpaceAfter = 0 myTable.SpaceBefore = 0 For myCounter = 1 To myTable.Rows.Count Set myRow = myTable.Rows.Item(myCounter) myRow.FirstBaselineOffset = idLeading myRow.BottomInset = 0 myRow.TopInset = 0 If myCounter = 1 Then myRow.LeftInset = 0 Else myRow.LeftInset = "0p6" End If If myCounter > 1 Then myRow.RightInset = 0 Else myRow.RightInset = "0p6" End If myRow.InnerColumnStrokeWeight = 0 Next End Sub
Again, I would stress: this is not a workaround; it's simply how you compose side by side paragraphs in a WYSIWYG page layout program. We don't have to rely on invisible characters/odd left/right indents, etc., and we gain the ability to control the widths of the columns we apply (most side by side schemes simply split the column in half--as in this example, but we're not limited to that behavior).
I'll post an example of doing this via find/change techniques as soon as I can.
Thanks,
Ole
Technical Details
Message-ID:
<ef88d10.10@WebX.aaQKaf7vad4>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-05!supernews.com!feed.textport.net!out.nntp.be!propagator2-SanJose!propagator-SanJose!in.nntp.be!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!WebXReferences:
<ef88d10.-1@WebX.aaQKaf7vad4>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,22ddfa026b436769 X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2002-06-11 13:07:44 PST From: "Olav Kvern" <okvern@adobe.com> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-05!supernews.com!feed.textport.net!out.nntp.be!propagator2-SanJose!propagator-SanJose!in.nntp.be!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!WebX Newsgroups: adobe.scripting.indesign Subject: Re: Vertical tabulation Message-ID: <ef88d10.10@WebX.aaQKaf7vad4> Date: Tue, 11 Jun 2002 12:51:50 -0700 References: <ef88d10.-1@WebX.aaQKaf7vad4> Lines: 95 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit