Article View: adobe.scripting.indesign
Article #20717Re: Vertical tabulation
From: Olav Kvern
Date: Tue, 11 Jun 2002 22:09
Date: Tue, 11 Jun 2002 22:09
9 lines
8198 bytes
8198 bytes
Gang--
Here's an example using find/change techniques.
Private Sub Command1_Click() Dim myInDesign As InDesign.Application Set myInDesign = CreateObject("InDesign.Application.2.0") Rem Create a dummy document Set myDocument = myInDesign.Documents.Add myDocument.DocumentPreferences.PageHeight = "9i" myDocument.DocumentPreferences.PageWidth = "7i" Set myParaStyle = myDocument.ParaStyles.Add myParaStyle.Name = "headline" myParaStyle.PointSize = 24 myParaStyle.Leading = 24 myParaStyle.SpaceAfter = "24pt" myParaStyle.LeftIndent = "128pt" Set myParaStyle = myDocument.ParaStyles.Add myParaStyle.Name = "body_text" myParaStyle.LeftIndent = "128pt" myParaStyle.PointSize = 10 myParaStyle.Leading = 12 Set myParaStyle = myDocument.ParaStyles.Add myParaStyle.Name = "body_side" myParaStyle.LeftIndent = 0 myParaStyle.PointSize = 10 myParaStyle.Leading = 12 Set myParaStyle = myDocument.ParaStyles.Add myParaStyle.Name = "side_head" myParaStyle.PointSize = 10 myParaStyle.Leading = 12 Set myPage = myDocument.Pages.Item(1) Set myTextFrame = myPage.TextFrames.Add myTextFrame.TextFramePreferences.FirstBaselineOffset = idLeading 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) myAddDummyText myTextFrame, myDocument myInDesign.FindPreferences = idNothing myInDesign.ChangePreferences = idNothing myInDesign.FindPreferences.ParagraphStyle = myDocument.ParaStyles.Item("side_head") Set myStory = myTextFrame.ParentStory Set myFoundItems = myTextFrame.Search For myCounter = myFoundItems.Count To 1 Step -1 Set myParagraph = myFoundItems.Item(myCounter) myLastIndex = myParagraph.InsertionPoints.Item(myParagraph.InsertionPoints.Count).Index Set myNextCharacter = myStory.Characters.Item(myLastIndex) Set myNextParagraph = myNextCharacter.Paragraphs.Item(1) Set myTable = myParagraph.Tables.Add myTable.Columns.Item(1).Width = "128pt" Rem Add a column. Set myColumn = myTable.Columns.Add myColumn.Width = myDocument.DocumentPreferences.PageWidth - (myX1 + myPage.MarginPreferences.MarginRight + myTable.Columns.Item(1).Width) Rem Move the second paragraph into the table myNextParagraph.Move idAtBeginning, myTable.Cells.Item(2) myTable.Cells.Item(2).Texts.Item(1).ParagraphStyle = myDocument.ParaStyles.Item("body_side") myTable.Cells.Item(2).Texts.Item(1).Characters.Item(myTable.Cells.Item(2).Texts.Item(1).Characters.Count).Delete Rem Remove the default table strokes, spacing. 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 For myRowCounter = 1 To myTable.Rows.Count Set myRow = myTable.Rows.Item(myRowCounter) myRow.FirstBaselineOffset = idLeading myRow.BottomInset = 0 myRow.TopInset = 0 myRow.InnerColumnStrokeWeight = 0 Next myTable.SpaceBefore = "12pt" myTable.Columns.Item(1).RightInset = "12pt" myTable.Columns.Item(1).LeftInset = 0 myTable.Columns.Item(2).LeftInset = 0 myTable.Columns.Item(2).RightInset = 0 Next End Sub Rem The following sub enters some example text. Private Sub myAddDummyText(myTextFrame, myDocument) myTextFrame.TextContents = "Headline" & vbCr myTextFrame.Paragraphs.Item(1).ParagraphStyle = myDocument.ParaStyles.Item("headline") Set myInsertionPoint = myTextFrame.InsertionPoints.Item(myTextFrame.InsertionPoints.Count) myInsertionPoint.TextContents = "This is the first paragraph of body text in the story. It goes on for a bit, but then stops, confused. What should it say? What does it need to communicate? It doesn't know." & vbCr myInsertionPoint.ParagraphStyle = myDocument.ParaStyles.Item("body_text") Set myInsertionPoint = myTetFrame.InsertionPoints.Item(myTextFrame.InsertionPoints.Count) myInsertionPoint.TextContents = "Hanging Side Heading That May Stretch to Multiple Lines" & vbCr myInsertionPoint.ParagraphStyle = myDocument.ParaStyles.Item("side_head") Set myInsertionPoint = myTextFrame.InsertionPoints.Item(myTextFrame.InsertionPoints.Count) myInsertionPoint.TextContents = "This is the next paragraph of body text in the story. It goes on for a bit, but then stops, confused. What should it say? What does it need to communicate? It doesn't know. This is the still more body text. It goes on for a bit, but then stops, confused. What should it say? What does it need to communicate? It doesn't know." & vbCr myInsertionPoint.ParagraphStyle = myDocument.ParaStyles.Item("body_text") Set myInsertionPoint = myTextFrame.InsertionPoints.Item(myTextFrame.InsertionPoints.Count) myInsertionPoint.TextContents = "This is the still more body text. It goes on for a bit, but then stops, confused. What should it say? What does it need to communicate? It doesn't know." & vbCr myInsertionPoint.ParagraphStyle = myDocument.ParaStyles.Item("body_text") Set myInsertionPoint = myTextFrame.InsertionPoints.Item(myTextFrame.InsertionPoints.Count) myInsertionPoint.TextContents = "This is the still more body text. It goes on for a bit, but then stops, confused. What should it say? What does it need to communicate? It doesn't know." & vbCr myInsertionPoint.ParagraphStyle = myDocument.ParaStyles.Item("body_text") Set myInsertionPoint = myTextFrame.InsertionPoints.Item(myTextFrame.InsertionPoints.Count) myInsertionPoint.TextContents = "This is the still more body text. It goes on for a bit, but then stops, confused. What should it say? What does it need to communicate? It doesn't know." & vbCr myInsertionPoint.ParagraphStyle = myDocument.ParaStyles.Item("body_text") Set myInsertionPoint = myTextFrame.InsertionPoints.Item(myTextFrame.InsertionPoints.Count) myInsertionPoint.TextContents = "Hanging Side Heading" & vbCr myInsertionPoint.ParagraphStyle = myDocument.ParaStyles.Item("side_head") Set myInsertionPoint = myTextFrame.InsertionPoints.Item(myTextFrame.InsertionPoints.Count) myInsertionPoint.TextContents = "This is the still more body text. It goes on for a bit, but then stops, confused. What should it say? What does it need to communicate? It doesn't know. This is the still more body text. It goes on for a bit, but then stops, confused. What should it say? What does it need to communicate? It doesn't know." & vbCr myInsertionPoint.ParagraphStyle = myDocument.ParaStyles.Item("body_text") Set myInsertionPoint = myTextFrame.InsertionPoints.Item(myTextFrame.InsertionPoints.Count) myInsertionPoint.TextContents = "This is the still more body text. It goes on for a bit, but then stops, confused. What should it say? What does it need to communicate? It doesn't know." & vbCr myInsertionPoint.ParagraphStyle = myDocument.ParaStyles.Item("body_text") Set myInsertionPoint = myTextFrame.InsertionPoints.Item(myTextFrame.InsertionPoints.Count) myInsertionPoint.TextContents = "This is the still more body text. It goes on for a bit, but then stops, confused. What should it say? What does it need to communicate? It doesn't know." & vbCr myInsertionPoint.ParagraphStyle = myDocument.ParaStyles.Item("body_text") End Sub
Thanks,
Ole
Technical Details
Message-ID:
<ef88d10.11@WebX.aaQKaf7vad4>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!supernews.com!novia!novia!proxad.net!proxad.net!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 15: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-06!supernews.com!novia!novia!proxad.net!proxad.net!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.11@WebX.aaQKaf7vad4> Date: Tue, 11 Jun 2002 15:09:44 -0700 References: <ef88d10.-1@WebX.aaQKaf7vad4> Lines: 173 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit