Article View: adobe.scripting.indesign
Article #20414Re: importing foxpro data
From: Peter Boctor
Date: Mon, 29 Jul 2002 23:58
Date: Mon, 29 Jul 2002 23:58
28 lines
1991 bytes
1991 bytes
Jae,
It is not possible to have the connection be live via scripting. You'd have to write an InDesign plugin for that.
I assume you can extract from Foxpro the number of rows and columns and then access the contents of each cell? Then you'd use a procedure similar to this:
Private Sub TestCreateTable()
CreateTable 2, 4, Array(Nothing, "Header 1", "Header 2", "Header 3", "1", "2", "3", "4")
End Sub
Private Sub CreateTable(numRows, numColumns, tableContent)
Set ID = CreateObject("InDesign.Application")
Set myDoc = ID.Documents.Add
Set myFrame = myDoc.TextFrames.Add
myFrame.GeometricBounds = Array(0, 0, Str(numRows + 1) & "in", Str(numColumns + 1) & "in")
Set myTable = myFrame.Tables.Add
myTable.ColumnCount = numColumns
myTable.RowCount = numRows
myTable.Width = Str(numColumns) & "in"
myTable.Height = Str(numRows) & "in"
myTable.Cells.ItemByRange(myTable.Cells.Item(1), myTable.Cells.Item(-1)).Item(1).TextContents = tableContent
End Sub
Essentially this is passing in an array of values, one for each cell. If an array entry is empty (Nothing) then the cell is skipped, ie its contents are not touched.
Hope this helps.
-peter
Technical Details
Message-ID:
<ef9ea8e.0@WebX.aaQKaf7vad4>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-05!sn-xit-01!sn-xit-04!supernews.com!news.maxwell.syr.edu!colt.net!diablo.netcom.net.uk!netcom.net.uk!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!WebXReferences:
<ef9ea8e.-1@WebX.aaQKaf7vad4>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,5850bb65216741b8 X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2002-07-29 17:12:55 PST From: "Peter Boctor" <peter.boctor@adobe.com> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-05!sn-xit-01!sn-xit-04!supernews.com!news.maxwell.syr.edu!colt.net!diablo.netcom.net.uk!netcom.net.uk!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!WebX Newsgroups: adobe.scripting.indesign Subject: Re: importing foxpro data Message-ID: <ef9ea8e.0@WebX.aaQKaf7vad4> Date: Mon, 29 Jul 2002 16:58:24 -0700 References: <ef9ea8e.-1@WebX.aaQKaf7vad4> Lines: 27 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit