Skip to main content
dublove
Legend
December 24, 2024
Question

How do I modify this script , make it duplicates the currently selected rows

  • December 24, 2024
  • 1 reply
  • 282 views

How do I modify this script , make  it duplicates the currently selected rows
Then add a empty at the table top

//first table in the active document
var table=app.activeDocument.textFrames[0].parentStory.tables[0]
dupeTopRow(table);
table.rows.add(LocationOptions.BEFORE, table.rows[0]);

/**
* duplicate the first row af a table 
* @ param the table 
* @ return void 
*/
function dupeTopRow(t){
    var nr = t.rows.add(LocationOptions.BEFORE, t.rows[0]);
    var c = nr.cells
    var lr = t.rows[1].cells
    for (var i = 0; i < c.length; i++){
        c[i].properties = lr[i].properties;
    };   
}
This topic has been closed for replies.

1 reply

Community Expert
December 26, 2024

What does this script do? A broader look seems it does/tries to do what you want. So please explain what is the current behaviour of the code snippet you shared and what exact modifications are needed in that behaviour.

-Manan

-Manan
dublove
dubloveAuthor
Legend
December 26, 2024

Copies the currently selected line and then adds a blank line before the first line.
Next I'm going to convert the first and second rows to table headers