Javascript target footer row
Learn / Forums / InDesign Add-ons (Scripts, Scripting, and Plug-ins) / Javascript target footer row
Tagged: JavaScript Tables Footers
- This topic has 2 replies, 3 voices, and was last updated 6 years, 3 months ago by Peter Kahrel.
-
AuthorPosts
-
-
December 9, 2017 at 2:39 pm #100239James WelshMember
What I want to do is using
// based on https://creativepro.com/tackling-tables-through-scripting.php
// by Theunis De JongTarget the tables in a document and set hte topEdgeStrokeColor and topEdgeStrokeWeight of the nth footer row. I can’t just use the ros[-1] to style the last row to “look” like a footer because we use real footers to deal with tables that continue from the bottom one page to the next page.
This is what I’m trying (I’ve tried other objects too). For the life of me I can find the correct target in the document object model. Tried to use this as well… https://jongware.mit.edu/idcs6js/pc_Table.html
function processTable(table)
{
table.footerRows[0].cells.properties = {topEdgeStrokeColor: “CBOC Blue”};
} -
December 10, 2017 at 10:36 am #100247Kai RübsamenMember
It seems, that you cannot target footer rows directly?! Maybe there is an easier solution, but the following lines are working:
main(); function main() { var allTables = app.activeDocument.stories.everyItem().tables.everyItem().getElements(); for (var i = 0; i < allTables.length; i++) { var curTable = allTables[i]; var numberOfFooterRows = curTable.footerRowCount; var fRows = curTable.rows.itemByRange(-numberOfFooterRows, -1).getElements(); var firstFooterRow = fRows[0]; firstFooterRow.properties = {topEdgeStrokeColor: "CBOC Blue"}; } }
Kai
-
December 14, 2017 at 5:23 am #100332Peter KahrelParticipant
Hi Kai,
> you cannot target footer rows directly?!
Well, in a way you can:
The nth footer row in a table:
myTable.rows [myTable.headerRowCount + myTable.bodyRowCount + n-1]
Peter
-
-
AuthorPosts
- You must be logged in to reply to this topic.