Script to convert first row of table to header row
Hi, so I've used this script a few weeks ago and it worked great. Now for some reason, I'm getting an error "cannot set row type" when running it.
var myTables = app.activeDocument.stories.everyItem().tables;
for (var i = 0; i < myTables.length; i++) {
myTables.rows.firstItem().rowType = RowTypes.HEADER_ROW;
}
All of my tables have a style set with the correct cell styles applied to the table style. I did see another script that said it worked even if some tables already had a header row applied, but that one gave me an error as well.
var myTables = app.activeDocument.stories.everyItem().tables.everyItem().getElements();
for (var i = 0; i < myTables.length; i++) {
var curTable = myTables;
var firstRow = curTable.rows[0];
if (firstRow.rowType != RowTypes.HEADER_ROW) {
firstRow.rowType = RowTypes.HEADER_ROW;
}
}
Any idea of what might be wrong with it?
