Article View: adobe.scripting.indesign
Article #19744Re: Creating tables on the fly, Windows InDesign
From: GeekGod
Date: Wed, 20 Nov 2002 18:19
Date: Wed, 20 Nov 2002 18:19
33 lines
2349 bytes
2349 bytes
Now I've stumbled onto a new problem. The find characterstyle portion is not working.... I just can't win here.
Here's my code:
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
myInDesign.Open ("d:\testcharstyletable.indd")
Set myDocument = myInDesign.Documents.item(1)
Rem Create an example character style.
Set findstyle = myDocument.CharStyles.Add
'Set mytextframe = myDocument.Pages.Item(1).TextFrames.Add
' clear out existing data
myInDesign.FindPreferences = idNothing
myInDesign.ChangePreferences = idNothing
' setup find style
'myInDesign.FindPreferences.CharacterStyle = "oats_storetextframe"
CharacterStyle = "oats_storetextframe"
Set findstyle = myDocument.CharStyles.item(CharacterStyle)
Set FoundText = myDocument.Search
If FoundText.Count > 0 Then
For myCounter = FoundText.Count To 1 Step -1
Set myFoundItem = FoundText.item(myCounter)
Set mytextframe = myFoundItem.Tables.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
Next
End If
Technical Details
Message-ID:
<1de68f3a.22@WebX.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-05!sn-xit-01!sn-xit-04!supernews.com!news.maxwell.syr.edu!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-20 10:37:46 PST From: GeekGod <geekgod@geekgod.com> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-05!sn-xit-01!sn-xit-04!supernews.com!news.maxwell.syr.edu!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.22@WebX.la2eafNXanI> Date: Wed, 20 Nov 2002 10:19:23 -0800 References: <1de68f3a.-1@WebX.la2eafNXanI> Lines: 37 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit