On 26/08/2010 20:46, Jason Berk wrote:
> How would I change the background of a single row in a table event?
You've sent this question to me privately AND to the mailing list.
Please use the mailing list address only.
> Do
> I have to loop over all the rows like this:
If you only want to change the background of 1 row,
there's no point in looping over all the rows.
> int footer = widths.length - table.getFooterRows();
> int header = table.getHeaderRows() - table.getFooterRows();
> for (int row = header; row< footer; row++) {
> if (row == 0){
> // do something to the row
> }
> }
Did you take that snippet from here:
http://itextpdf.com/examples/index.php?page=example&id=93
If so, you can see that this rectangle is created:
rect = new Rectangle(widths[row][0], heights[row],
widths[row][columns], heights[row + 1]);
Suppose that you want to set the background of row 3,
then you don't need the loop, you can just replace the
row variable with 3.
Caveat: what are you going to do if the table is
distributed over different pages?
In that case, you'd better set the background of the
cells of the row. Read chapters 4 and 5 of the 2nd edition
of iText in Action to find out the difference.
--
This answer is provided by 1T3XT BVBA
http://www.1t3xt.com/ - http://www.1t3xt.info
------------------------------------------------------------------------------
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users
worldwide. Take advantage of special opportunities to increase revenue and
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://www.itextpdf.com/book/
Check the site with examples before you ask questions:
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/