
Copy link to clipboard
Copied
Hi all,
My client decided they want to add a row at the end of all the tables with a note. I figured out how to add the row using the script below, but cannot figure out how to merge that row and then add in the new copy. Currently the tables are one row, three columns. The new row should be merged across all the columns (see example below). Can anyone tell me if this is even possible to script? I have tons of documents I have to do this on so any help would be greatly appreciated!
var curDoc = app.activeDocument;
var allTables = curDoc.stories.everyItem().tables.everyItem().getElements();
for ( var t = 0; t < allTables.length; t++ ) {
var curTable = allTables
var allRows = curTable.rows;
curTable.rows.add(LocationOptions.AT_END);
}
1 Correct answer
I'm not on my PC now, but I would try something like:
var curDoc = app.activeDocument;
var allTables = curDoc.stories.everyItem().tables.everyItem().getElements();
for ( var t = 0; t < allTables.length; t++ ) {
var curTable = allTables
var allRows = curTable.rows;
var newRow = curTable.rows.add(LocationOptions.AT_END);
newRow.cells.everyItem().merge();
}
>
Copy link to clipboard
Copied
I'm not on my PC now, but I would try something like:
var curDoc = app.activeDocument;
var allTables = curDoc.stories.everyItem().tables.everyItem().getElements();
for ( var t = 0; t < allTables.length; t++ ) {
var curTable = allTables
var allRows = curTable.rows;
var newRow = curTable.rows.add(LocationOptions.AT_END);
newRow.cells.everyItem().merge();
}
>
Copy link to clipboard
Copied
Corullon,
Next time, turn on your machine! …
newRow.cells[0].merge (newRow.cells[-1]);
(^/)

Copy link to clipboard
Copied
That worked, thank you both! Is there a way to add this copy to that row as well?
Note: If the student responds incorrectly, proceed to the next set of DO and SAY statements below.
Copy link to clipboard
Copied
newRow.contents = "Note: If the student responds incorrectly, proceed to the next set of DO and SAY statements below."
(^/)

Copy link to clipboard
Copied
Thanks that worked!!!!
Copy link to clipboard
Copied
I am locking this topic, if you feel that I have done so in error, please PM me and I will reverse the action.
This document may be useful Guidelines & Tips for the Adobe Forums
Copy link to clipboard
Copied
Unnecessary.
Because I know If I'm wrong (or even if I'm right) you'll have something to
add to my answer. Any of them. Of course, with a lot of sarcasm, irony, and
a lot of pleasure.
Em 16 de dez de 2017 02:26, "tanyaz97840591" <forums_noreply@adobe.com>
escreveu:
Adobe Community <https://forums.adobe.com/?et=watches.email.outcome>
Looking for a script to add one row at the end of a table, merge it and
add text
tanyaz97840591
<https://forums.adobe.com/people/tanyaz97840591?et=watches.email.outcome>
marcou a resposta de Obi-wan Kenobi
<https://forums.adobe.com/people/Obi-wan+Kenobi?et=watches.email.outcome>
para Looking for a script to add one row at the end of a table, merge it
and add text
<https://forums.adobe.com/thread/2426465?et=watches.email.outcome> como
útil. Visualizar a resposta completa
<https://forums.adobe.com/message/10045145?et=watches.email.outcome#10045145>
Copy link to clipboard
Copied
Keep cool, dude! ... and stop your paranoia [and your verbal aggression]!
You said you was not on your machine! ... I just kindly [answering to you with a little humor!] advised you to avoid this to avoid writing nonsense! [just a friendly advice to remain you credible in the future!]
… But, if you don't appreciate comments when you make errors (or not), avoid "forums"!
(^/)
PS: Recent threads I've read and where I didn't make comment on your verbiage:
Finding two different characters in same paragraph
… even if!
Copy link to clipboard
Copied
My paranoia???
OK, Michel. OK.
My verbal aggression???
OK, Michel.
I'm so sorry, man, to think you're pursuing me to the point of collect threads where I post and know where you have commented or not with your very very particular sense of humor.
Let's remember that your attention was called by the administrator of one of the most promising groups on Facebook on the same points that I always claim.
I'm sorry to the other forum members, but I really can not cope with Mr. Michel's always superior, sarcastic, ironic remarks. When he has no empathy for someone, he's the most unbearable as it's possible to be.
If the administrators of this forum want to take an action, it's the moment. If you (administrators) want I leave the forum, it'll be a pleasure. I just want to remember that I'm here to learn and TRY to help with my little knowledge. I never ever answered people questions with sarcasm, superiority or with the goal to make money, as it's clearly the attitudes Michel have not just here, but in all other forums where I have the disgusting to be with him.
Look to your historic, Mr. Michael. Worry about what people think about you and your behavior. Don't be stuck here. Hear people on Facebook groups. Hear not only your friends. Hear people you answered trying to sell your codes.
You're not the only one with reason. Your ways are not the only ones to do what needs to be done. Your thoughts are not the magical truth. You need to be more human, less worried about money. Do you know we can be very satisfied with the thanks of people? If you help and do your best trying to help, maybe you can make your so desired money in a near future. You will never make money making people feeling stupid or ignorant as you always do with an absurd majesty!
"Even if" InDesign is, for you, just for fun, and the French fries are your main occupation, as you mentioned in a Facebook group. Or not.
