Article View: adobe.scripting.indesign
Article #19743Re: Creating tables on the fly, Windows InDesign
From: GeekGod
Date: Wed, 20 Nov 2002 18:27
Date: Wed, 20 Nov 2002 18:27
40 lines
2401 bytes
2401 bytes
I figured out the above and now I am at this point (where I was when I first started)...
Set myInDesign = CreateObject("inDesign.Application.2.0")
myInDesign.Open ("d:\testcharstyletable.indd")
Set myDocument = myInDesign.Documents.item(1)
CharacterStyle = "oats_storetextframe"
Set findstyle = myDocument.CharStyles.item(CharacterStyle)
' clear out existing data
myInDesign.FindPreferences = idNothing
' setup find style
myInDesign.FindPreferences.CharacterStyle = findstyle
' clear out existing data
myInDesign.ChangePreferences = idNothing
' get a collection of text objects that have that style applied
myInDesign.ChangePreferences.CharacterStyle = findstyle
'Set FoundText = myDocument.Search("", , , "")
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
myFoundItem.Tables.Add
myFoundItem.GeometricBounds = myGetBounds(myDocument.Pages.item(1), myDocument)
myFoundItem.TextContents = "This is paragraph 1." & vbCr & "This is paragraph 2." & vbCr & "This is paragraph 3." & vbCr & "This is paragraph 4."
myFoundItem.Paragraphs.item(2).CharacterStyle = findstyle
myFoundItem.Paragraphs.item(4).CharacterStyle = findstyle
Next
End If
It finds the character style but once it trys to invoke:
myFoundItem.Tables.Add
I get:
Object doesn't support this property or method.
What is going on here? I am completly lost.
Technical Details
Message-ID:
<1de68f3a.23@WebX.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!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-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.23@WebX.la2eafNXanI> Date: Wed, 20 Nov 2002 10:27:49 -0800 References: <1de68f3a.-1@WebX.la2eafNXanI> Lines: 44 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit