No my problem is not solved!! :(
I dont see any red color for the table headers.
PdfPTable docHistTable = new PdfPTable(3);
docHistTable.setTableEvent(*docHistoryTableEvent*);
docHistTable.setHeaderRows(1);
PdfPCell docHistContdTableHeaderCell = new PdfPCell(docHistContdPara);
docHistContdTableHeaderCell.disableBorderSide(Rectangle.LEFT|Rectangle.RIGHT|Rectangle.TOP|Rectangle.BOTTOM);
docHistContdTableHeaderCell.setColspan(3);
//docHistContdTableHeaderCell.setBackgroundColor(Color.RED);
docHistContdTableHeaderCell.setCellEvent(*
docHistTableHeaderCellEvent*);
docHistTable.addCell(docHistContdTableHeaderCell);
//iterate over some data list
while(dataList.hasNext()){
//add data cells.
}
document.add(docHistTable);
............snip..................
PdfPCellEvent *docHistTableHeaderCellEvent*=new PdfPCellEvent(){
public void cellLayout(PdfPCell cell, Rectangle
rect,PdfContentByte[] canvases) {
PdfContentByte
backCb=canvases[PdfPTable.BACKGROUNDCANVAS];
backCb.setRGBColorFill(0xFF, 0x00, 0x00);
backCb.rectangle(rect.getLeft(),
rect.getBottom(),rect.getWidth(), rect.getHeight());
backCb.fill();
backCb.resetRGBColorFill();
}
};
PdfPTableEvent *docHistoryTableEvent*=new PdfPTableEvent(){
public void tableLayout(PdfPTable table, float[][]
widths,float[] heights, int headerRows, int rowStart,PdfContentByte[]
canvases) {
try {
//image height/width pos calculations....
table.getDefaultCell().disableBorderSide(Rectangle.LEFT|Rectangle.RIGHT|Rectangle.TOP|Rectangle.BOTTOM);
PdfContentByte bgCanvas=
canvases[PdfPTable.BACKGROUNDCANVAS];
Image img=Image.getInstance(docHistoryBackImg);
bgCanvas.addImage(img,imageWidth,0,0,imageHeight,xPos,yPos,true);
} catch (BadElementException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (DocumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
};
On Wed, Mar 18, 2009 at 8:54 PM, 1T3XT info <[email protected]> wrote:
> Subhrajyoti Moitra wrote:
> > Really sorry about the confusion!!
> >
> > I have a table. I am setting the background image for this table using a
> > table event.
> > In the table the header cells are of different background. So in order
> > to set the background of the header cells only, i wrote a cell event and
> > there too i set the background color for the cell.
> > This event is only set in the header cells. The other body cells are
> > normal and will use the table background.
> >
> > Is this making sense.. apologize for the confusing question.
>
> OK, so in other words: your problem is solved?
> If not, adapt the example I attached so that it reproduces the problem.
> Because if I can't reproduce the problem, there is no problem!
> --
> This answer is provided by 1T3XT BVBA
> http://www.1t3xt.com/ - http://www.1t3xt.info
>
>
> ------------------------------------------------------------------------------
> Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
> powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
> easily build your RIAs with Flex Builder, the Eclipse(TM)based development
> software that enables intelligent coding and step-through debugging.
> Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
> _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
> Buy the iText book: http://www.1t3xt.com/docs/book.php
>
------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://www.1t3xt.com/docs/book.php