• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
10

A couple of scripts that worked in earlier versions of ID

Participant ,
Feb 20, 2024 Feb 20, 2024

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.

Screenshot 2024-02-20 at 9.47.48 PM.png

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”

 

https://community.adobe.com/t5/indesign-discussions/selecting-last-row-of-table/m-p/5151572/highligh...

 

 

Screenshot 2024-02-20 at 9.12.18 PM.png

TOPICS
How to , Scripting

Views

113

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Feb 21, 2024 Feb 21, 2024

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.

Votes

Translate

Translate
Community Expert ,
Feb 20, 2024 Feb 20, 2024

Copy link to clipboard

Copied

For the latter two scripts, do you have Cell Styles (not Character Styles) with the correct name? 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 21, 2024 Feb 21, 2024

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.

Screenshot 2024-02-21 at 9.18.45 AM.png

and

app.documents[0].stories.everyItem().tables.everyItem().rows.add(LocationOptions.AT_END).cells.everyItem().appliedCellStyle = "EndRow"

the same. Cell styles names checked.

Screenshot 2024-02-21 at 9.26.27 AM.png

Thanks.


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 21, 2024 Feb 21, 2024

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 21, 2024 Feb 21, 2024

Copy link to clipboard

Copied

LATEST

Peter, thanks for these splendid solutions.
The strength of this forum lies in people like you.
Best regards.

C.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines