Remove Background Color From all Tables in Book
I have a script that uses character background color to highlight a list of special words throughout a book. When the editor is done checking the words I have another script that changes the background color back to "None." The script works great removing the background color from from both pgfs and tables in individual documents. However, when running it on an entire book, it won't remove the background colors in the tables, even though I'm stepping through each document in the book one by one. It seems to find the tables, because I can get a table count for the book, but it appears it isn't stepping through each table cell by cell. Any suggestions?
function stepThruTables() {
for (n = 1; n <= count; n++) {
totalTbls = 0
doc = SimpleOpen(openDocs[n]);
doc = app.ActiveDoc;
pgf = doc.MainFlowInDoc.FirstTextFrameInFlow.FirstPgf;
tblCleaner();
}
}
function tblCleaner() {
while (doc.ObjectValid())
{
tbl = doc.FirstTblInDoc;
if(tbl.ObjectValid() == false) {
$.writeln("Didn't find any tables!");
}
while (tbl.ObjectValid())
{
totalTbls++;
row = tbl.FirstRowInTbl;
while (row.ObjectValid())
{
cell = row.FirstCellInRow;
while (cell.ObjectValid())
{
var cellPgf=cell.FirstPgf;
tr = new TextRange();
textObj = getText(cell); // Calls "getText" function
RemoveTableBkColor (text, textObj);
cell = cell.NextCellInRow;
}
row = row.NextRowInTbl;
}
tbl = tbl.NextTblInDoc;
}
doc = doc.NextOpenDocInSession;
}
totalTbls = totalTbls - 1;
}char
