Article View: adobe.scripting.indesign
Article #19347Re: ID Tables auto updating possible via Scripting?
From: maxdunn
Date: Mon, 06 Jan 2003 00:25
Date: Mon, 06 Jan 2003 00:25
32 lines
2571 bytes
2571 bytes
Yes, you can update tables from a database. You can either re-generate the table from scratch dynamically, or (if there is always a fixed number of rows) just set the text content of existing cells in a table.
For example a VB script could run an Oracle stored procedure or SQL query over ODBC, and iterate through the resulting recordset, adding (or updating the content of) rows to a table as it goes.
You can dynamically format the rows and cells of a table, and the format/styles of text within that table. Here's a brief extract from such a script that should give some idea:
...
' get field from database
sSubHeader = rs.Fields("SubHeader")
' i increments for each record/row
oTable.Rows.Item(i).InnerColumnStrokeType = idNoStrokeType
oTable.Rows.Item(i).KeepWithNextRow = True
oTable.Rows.Item(i).Merge
' set content of cell
oTable.Rows.Item(i).Cells.Item(1).TextContents = sSubHeader
oTable.Rows.Item(i).Cells.Item(1).Texts.Item(1).AppliedFont = "Helvetica"
oTable.Rows.Item(i).Cells.Item(1).Texts.Item(1).FontStyle = "Medium"
oTable.Rows.Item(i).Cells.Item(1).Texts.Item(1).PointSize = 7
oTable.Rows.Item(i).Cells.Item(1).Texts.Item(1).Leading = 7
oTable.Rows.Item(i).Cells.Item(1).Texts.Item(1).HorizontalScale = 100
oTable.Rows.Item(i).Cells.Item(1).Texts.Item(1).Tracking = 0
oTable.Rows.Item(i).Cells.Item(1).Texts.Item(1).LeftIndent = "0p0"
oTable.Rows.Item(i).Cells.Item(1).Texts.Item(1).Hyphenation = False
oTable.Rows.Item(i).Cells.Item(1).BottomInset = "0p0"
oTable.Rows.Item(i).Cells.Item(1).TopInset = "0p0"
oTable.Rows.Item(i).Cells.Item(1).RightInset = "0p2"
oTable.Rows.Item(i).Cells.Item(1).LeftInset = "0p2"
oTable.Rows.Item(i).Cells.Item(1).VerticalJustification = idCenterVertical
...
HTH,
Max
Technical Details
Message-ID:
<1de73ea9.0@WebX.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebXReferences:
<1de73ea9.-1@WebX.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,3e0f9e31c73750fd X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2003-01-05 16:38:10 PST From: maxdunn <maxdunn@siliconpublishing.com> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebX Newsgroups: adobe.scripting.indesign Subject: Re: ID Tables auto updating possible via Scripting? Message-ID: <1de73ea9.0@WebX.la2eafNXanI> Date: Sun, 5 Jan 2003 16:25:55 -0800 References: <1de73ea9.-1@WebX.la2eafNXanI> Lines: 40 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit