Copy link to clipboard
Copied
Hi All,
I have a function call 'addHeaderRowContinue' and this is running ok on desktop version of indesign but when I run on InDesign CC 2017 server queue gets quit at below line:
table.cells.itemByRange(startIndex.join(":"), endIndex.join(":")).merge();
Below is the complete function. Can anyone help me out from this?
function addHeaderRowContinue(table) {
var counter, row, headerRowCount, cellCounter, cell, column, newRow, startIndex, endIndex, newCell, tableTitleElement, elementCounter;
try {
headerRowCount = 0;
for (counter = 0; counter < table.rows.length; counter++) {
try {
if ((row = table.rows[counter]).cells[0].associatedXMLElement.markupTag.name.match(/(tabletitle|tch)/i)) {
headerRowCount++;
}
else break;
}
catch (e) {
generateLog(e);
}
}
myDoc.recompose();
for (counter = headerRowCount - 1; counter >= 0; counter--) {
try {
row = table.rows[counter];
newRow = table.rows.add(LocationOptions.AFTER, table.rows[headerRowCount - 1]);
newRow.cells.everyItem().unmerge();
}
catch (e) {
generateLog(e);
}
}
myDoc.recompose();
for (counter = 0; counter < headerRowCount; counter++) {
try {
row = table.rows[counter];
newRow = table.rows[counter + headerRowCount];
for (cellCounter = 0; cellCounter < row.cells.length; cellCounter++) {
try {
cell = row.cells[cellCounter];
if (cell.columnSpan > 1 || cell.rowSpan > 1) {
var startIndex = newRow.cells[cellCounter].cells[0].name.split(":");
var endIndex = [];
endIndex[0] = (+startIndex[0]) + cell.columnSpan - 1;
endIndex[1] = (+startIndex[1]) + cell.rowSpan - 1;
table.cells.itemByRange(startIndex.join(":"), endIndex.join(":")).merge();
}
cell.texts[0].duplicate(LocationOptions.AT_BEGINNING, newCell);
myDoc.recompose();
}
catch (e) {
generateLog(e);
}
}
}
catch (e) {
generateLog(e);
}
}
table.rows.itemByRange(0, headerRowCount - 1).rowType = RowTypes.HEADER_ROW;
table.breakHeaders = HeaderFooterBreakTypes.ONCE_PER_PAGE;
table.skipFirstHeader = true;
}
catch (e) {
generateLog(e);
}
}
Regards
Have something to add?
Find more inspiration, events, and resources on the new Adobe Community
Explore Now