Skip to main content
dublove
Legend
June 6, 2025
Question

There are two table header rows, what is the script to copy these two rows as normal rows?

  • June 6, 2025
  • 1 reply
  • 719 views

 

 

If the table header row is only one row, this script seems to work.
But if there are two table header rows, this header is again basically dizzy and hopeless.

 

dupeTopRow(myTable);
	myTable.rows.add(LocationOptions.BEFORE, myTable.rows[0]);
/**
* duplicate the first row af a myTable 
* @ param the myTable 
* @ return void 
*/
function dupeTopRow(t){
    var newRow = t.rows.add(LocationOptions.BEFORE, t.rows[0]);
    var newCell = newRow.cells
    var lr = t.rows[1].cells
    for (var i = 0; i < newCell.length; i++){
        newCell[i].properties = lr[i].properties;
    };   

 

1 reply

Community Expert
June 6, 2025

Hi @dublove ,

your code will not work.

Because it will add a new row before the header row. And that automatically becomes an additional header row.

An additional body row must be added after the last header row.

Why? A table cannot start with a body row followed by a header row.

 

So what, I have to ask, will you like to do?

Converting all header rows to body rows because you want to add a body row at the start of your table?

Or do you want a new body row before the first body row and leave all header rows as they are?

 

Please explain.

 

Thanks,
Uwe Laubender
( Adobe Community Expert )

dublove
dubloveAuthor
Legend
June 6, 2025

Hi @Laubender 

I want to copy the header row and make a fake header row on page 1. The real table header row is on page 2.
This script deals with one row, but I don't know how to deal with it if there are 2 rows of header rows.

Thank you.

Community Expert
June 6, 2025

I'm not really sure what you're asking - but there's a way to skip header rows in the Table Options 

 

 

You can skip headers in Tables - here I skipped the header rows - so it's in 2nd row now

 Start with something like this

 

Then change  the setting

 

Then it skips automatically - so you can put whatever you want in the first one

The 2nd one controls the headers, so changing the 2nd one would change the 3rd column