Article View: adobe.scripting.indesign
Article #19876Re: Creating tables on the fly, Windows InDesign
From: Olav Kvern
Date: Wed, 20 Nov 2002 00:19
Date: Wed, 20 Nov 2002 00:19
39 lines
2110 bytes
2110 bytes
GeekGod--
Try this:
Dim myInDesign As InDesign.Application
Dim FoundText As InDesign.Objects
Set myInDesign = CreateObject("InDesign.Application.2.0")
Rem Create a dummy document
Set myDocument = myInDesign.Documents.Add
Rem Create an example character style.
Set findstyle = myDocument.CharStyles.Add
Set myTextFrame = myDocument.Pages.Item(1).TextFrames.Add
myTextFrame.GeometricBounds = myGetBounds(myDocument.Pages.Item(1), myDocument)
myTextFrame.TextContents = "This is paragraph 1." & vbCr & "This is paragraph 2." & vbCr & "This is paragraph 3." & vbCr & "This is paragraph 4."
myTextFrame.Paragraphs.Item(2).CharacterStyle = findstyle
myTextFrame.Paragraphs.Item(4).CharacterStyle = findstyle
' clear out existing data
myInDesign.FindPreferences = idNothing
myInDesign.ChangePreferences = idNothing
' setup find style
myInDesign.FindPreferences.CharacterStyle = findstyle
Set FoundText = myDocument.Search
If FoundText.Count > 0 Then
For myCounter = FoundText.Count To 1 Step -1
Set myFoundItem = FoundText.Item(myCounter)
myFoundItem.Tables.Add
Next
End If
Does this example work for you? I think part of the problem has been that it should be FoundText.Item(1), rather than FoundText.Items(1). Sorry I missed that!
Thanks,
Ole
Technical Details
Message-ID:
<1de68f3a.16@WebX.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-04!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!news.stealth.net!news.stealth.net!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebXReferences:
<1de68f3a.-1@WebX.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,734b037c90d04195 X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2002-11-19 16:42:05 PST From: "Olav Kvern" <okvern@adobe.com> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-04!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!news.stealth.net!news.stealth.net!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebX Newsgroups: adobe.scripting.indesign Subject: Re: Creating tables on the fly, Windows InDesign Message-ID: <1de68f3a.16@WebX.la2eafNXanI> Date: Tue, 19 Nov 2002 16:19:07 -0800 References: <1de68f3a.-1@WebX.la2eafNXanI> Lines: 40 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit