Copy link to clipboard
Copied
1. One is a script wrote by Manan Joshi that indeed inserts a row at the end of the table not in the character style indicated in the code but in the style of the row preceding it.
table.rows[-1].cells.everyItem().texts.everyItem().appliedCharacterStyle = “myriad regular”
**********
Manam wrote another version that gives this error.
app.documents[0].stories.everyItem().tables.everyItem().rows.add(LocationOptions.AT_END).cells.everyItem().appliedCellStyle = "StyleName"
https://community.adobe.com/t5/indesign-discussions/it-is-possible-to-add-one-row-or-a-line-of-text-...
/////////////////////
2. The another one, by Jump_Over, gives an error 21: “undefined is not an object”.
app.documents[0].stories.everyItem().tables.everyItem().rows.add(LocationOptions.AT_END).cells.everyItem().appliedCellStyle = “EndRow”
Camilo -- You'll have to split the long statement:
rows = app.documents[0].stories.everyItem().
tables.everyItem().rows.add (LocationOptions.AT_END);
for (i = 0; i < rows.length; i++) {
rows[i].cells.everyItem().appliedCellStyle = "c";
}
.add() creates an array of rows, and therefore cells.everyItem() doesn't work.
Copy link to clipboard
Copied
For the latter two scripts, do you have Cell Styles (not Character Styles) with the correct name?
Copy link to clipboard
Copied
Brian,
for
app.documents[0].stories.everyItem().tables.everyItem().rows.add(LocationOptions.AT_END).cells.everyItem().appliedCellStyle = "StyleName"
the error persists. Cell Style is adequately named. In the previous example used other names for cell styles but were changed in other tests.
and
app.documents[0].stories.everyItem().tables.everyItem().rows.add(LocationOptions.AT_END).cells.everyItem().appliedCellStyle = "EndRow"
the same. Cell styles names checked.
Thanks.
Copy link to clipboard
Copied
Camilo -- You'll have to split the long statement:
rows = app.documents[0].stories.everyItem().
tables.everyItem().rows.add (LocationOptions.AT_END);
for (i = 0; i < rows.length; i++) {
rows[i].cells.everyItem().appliedCellStyle = "c";
}
.add() creates an array of rows, and therefore cells.everyItem() doesn't work.
Copy link to clipboard
Copied
Peter, thanks for these splendid solutions.
The strength of this forum lies in people like you.
Best regards.
C.