Creating vertical gradients in table rows
Is it possible to create vertical gradients across each row in a table? I know this has been discussed on and off here but I can't find any good answers.
This code almost works . . . it assumes that there is text in the first cell of each row, and calculates the page coordinates of the cell (and hence the row) from the baseline:
var defineRowGradient = function ( theRow ) {
var firstCharacter = theRow.cells[ 0 ].characters[ 0 ];
var minimumOffset = theRow.minimumFirstBaselineOffset;
var topInset = theRow.topInset;
var top = firstCharacter.baseline - ( minimumOffset + topInset );
var left = firstCharacter.horizontalOffset - theRow.leftInset;
theRow.gradientFillStart = [ left, top ];
theRow.gradientFillAngle = -90;
theRow.gradientFillLength = theRow.height;
}
By "almost works" I mean that it works fine on tables that fit in a single frame. It falls apart when the table flows to another frame or another page. The page coordinate calculations seem to hold up, but the gradient isn't applied correctly to each row. The vertical position creeps up or down, or the rows are filled with solid color or left blank. It doesn't seem to matter if the gradient is applied as part of the cell style, or as an override. It seems as if something needs to be reset each time the table jumps to a new frame.
What's missing? Is there a way to fix this so it will work with multi-frame tables?
