Answered
Problem with NextTblInDoc
- Dear friends,
My test document has no reference pages, only master and body pages. There are 5 tables on the body pages. - The first table is 2 x 2 and in cell 1 the background is magenta (which is what is checked for).
- This cell is found
- Re-entering the while-loop after changing obj to obj.NextCellInTbl lets it run to the end of the table
- This is detected and the script should enter the first cell of the next table for further search.
- The log lists this:
«Table #1» cell 1 which was found
«Table #1» cell skipped
«Table #1» cell skipped
«Table #1» last cell in table
«» next "table"This is not the complete script, just the relevant parts.
obj = oDoc.FirstTblInDoc.FirstRowInTbl.FirstCellInRow;
while (obj.ObjectValid()) {
$.writeln("«" + obj.CellRow.RowTbl.UserString + "»");
if (CompareColour(obj.CellOverrideShading, kReserved, sColour)) {
break;
} else {
obj = obj.NextCellInTbl;
if (!obj.ObjectValid()) { // end of table ?
oRow = obj.CellRow;
oTbl = oRow.RowTbl.NextTblInDoc; // look for next table
$.writeln("«" + obj.CellRow.RowTbl.UserString + "»");
if (oTbl.ObjectValid()) {
obj = oTbl.FirstRowInTbl.FirstCellInRow;
continue; // restart search for relevant cell
}
}
}
}Why do I not enter the second table?
And BTW there is no non-scripted method to set the user string...

