Ok, I see. I would suggest that you create a Character Format that just sets the background color to what you want. Then you can use this function to apply it to each paragraph in the table.
function applyCharFmt (textRange, name, doc) {
var charFmt, prop;
charFmt = doc.GetNamedCharFmt (name);
if (charFmt.ObjectValid () === 1) {
doc.SetTextProps (textRange, charFmt.GetProps ());
}
else {
prop = new PropVal ();
prop.propIdent.num = Constants.FP_CharTag;
prop.propVal.valType = Constants.FT_String;
prop.propVal.sval = name;
doc.SetTextPropVal (textRange, prop);
}
}
But you still have to navigate each cell in the table and each paragraph in the cell. Something like this:
var cell, pgf;
// Assuming tbl is the table object.
cell = tbl.FirstRowInTbl.FirstCellInRow;
while (cell.ObjectValid () === 1) {
if (cell.CellIsStraddled === 0) {
pgf = cell.FirstPgf;
while (pgf.ObjectValid () === 1) {
// Make a text range and pass it to the applyCharFmt function.
// ...
pgf = pgf.NextPgfInFlow;
}
}
cell = cell.NextCellInTbl;
}
To get the TextRange to pass to the applyCharFmt function for each paragraph, use this:
var textRange;
textRange = new TextRange (new TextLoc (pgf, 0),
new TextLoc (pgf, Constants.OBJ_END_OFFSET - 1));
applyCharFmt (textRange, "whatever-you-named-your-Character-Format", doc);
I don't have time to test the code, but it should be pretty clean.
Thanks Rick...I really appreciate it. I'll load your code tomorrow and check it out. Hopefully won't have to bother you with that issue again. r/Curt