Great! One I can answer. Thanks! Try this: (code has been edited for brevity) private float grayFill = 0.8f; // 0.0 = black; 1.0 = white (no fill) private Boolean paintThisRowGray = false; // to control the alternate row painting
<while iterating over data to create one row> { ArrayList<PdfPCell> cellsForThisRow = new ArrayList<PdfPCell>(); cellsForThisRow.add(new PdfPCell(<create wonderful content>); .................. .................. } if (paintThisRowGray) { Iterator<PdfPCell> it = cellsForThisRow.iterator(); while (it.hasNext()) { PdfPCell theCell = new PdfPCell(); theCell = (PdfPCell) it.next(); theCell.setGrayFill(grayFill); } } Iterator<PdfPCell> it = cellsForThisRow.iterator(); while (it.hasNext()) { table.addCell(theCell); } paintThisRowGray = !paintThisRowGray; // flip the switch This serves to 'paint' every other row a light gray. If you need a color, you're on your own. See Rectangle.setBackgroundColor(). --dan fox Gopi Shankar wrote: > > Hai to all, > > I am new to i text, My problem is there are n rows in a table, > i need odd numbered rows to be in a color and even numbers to be in a > color, > > Plz help me > > > -- View this message in context: http://www.nabble.com/Rows-with-different-colors-tp23983060p23985406.html Sent from the iText - General mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensing option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php 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/