Good Afternoon!,
I have been working with iText for a week or so and have found it the
*BEST* PDF library available!! One requirement of a report I'm currently
working on is to have alternating row background colors. I spent some time
in forums all over the web, but couldn't find any properties in the
PdfPTable object or Document object that handles alternating row styles, so
I tried this brute force work around:
int curRow = 0;
while (I have more rows) {
boolean evenRow = ((curRow % 2) == 0);
Color color = (evenRow) ? Color.LIGHT_GRAY :
Color.WHITE;
curRow++;
Create PdfPCell;
add PdfPCell properties (e.g: background color);
add PdfPCell to PdfPTable;
}
The problem is that I end up with a checkered output. As you can see, if
there are an odd number of pages on page one, for example, page two will
start with a white row. What my requirement states is that each page starts
with a gray row.
Is there a way I can determine the current page number of a PdfPTable
object? If not, how can I tell when my data spills over to the next page?
Alternatively, if this is a poor approach, please enlighten me =D !
Thanks in advance for any direction you can provide!!
Respectfully,
John
--
View this message in context:
http://www.nabble.com/Alternating-Row-Colors-tf4470738.html#a12747355
Sent from the iText - General mailing list archive at Nabble.com.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/