Copy link to clipboard
Copied
«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...
if (!obj.ObjectValid()) { // end of table ?
oRow = obj.CellRow;
If obj is no longer valid (first line) then the second line won't work.
Copy link to clipboard
Copied
if (!obj.ObjectValid()) { // end of table ?
oRow = obj.CellRow;
If obj is no longer valid (first line) then the second line won't work.
Copy link to clipboard
Copied
Thanks Rick,
Yes, by the time I became blind at least on one eye...
This seems to work as expected:
while (obj.ObjectValid()) {
if (CompareColour(obj.CellOverrideShading, kReserved, sColour)) {
break;
} else {
oRow = obj.CellRow;
oTbl = oRow.RowTbl.NextTblInDoc; // look for next table prophylactivally
if (obj.NextCellInTbl.ObjectValid()) {
obj = obj.NextCellInTbl;
} else { // need go to next table
obj = oTbl.FirstRowInTbl.FirstCellInRow;// restart search for relevant cell
}
}
}