There are two types of borders. You use one or the other or a mix of the two. There's not a better border, each one has pros and cons. If you really want to be picky about the borders use a PdfPTableEvent or a PdfPCellEvent and draw the borders yourself in your correct way.
> -----Original Message----- > From: Mitch Freed [mailto:[EMAIL PROTECTED] > Sent: Thursday, November 03, 2005 3:12 PM > To: Paulo Soares; [email protected] > Subject: RE: [iText-questions] PdfPTable Cell Borders > > I feel like I'm missing something here. Should I be able to do normal > table borders on a table and have one cell that has a larger width > specified than the rest of the table and not have that border run into > the surrounding cells? The reason I brought up variable borders was > because when I turned on variable borders for the cell that has the > larger width specified, the border was contained within the cell. > Without specifying the variable border for the cell, the > border invades > the surrounding space and doesn't seem like it should. I want to make > sure I'm using the borders correctly. > > Here is an example again of what I'm talking about: > > --------------------- > [C#] > > PdfPTable table = new PdfPTable(new float[] {1f,1f,1f}); > table.DefaultCell.UseAscender = true; > table.DefaultCell.UseDescender = true; > table.DefaultCell.UseBorderPadding = true; > > PdfPCell header = new PdfPCell(); > header.AddElement(new Chunk("header with colspan 3")); > header.Colspan = > 3; header.UseAscender = true; header.UseDescender = true; > table.AddCell(header); > > PdfPCell c = new PdfPCell(); > c.AddElement(new Chunk("1.1")); > c.BorderWidth = 20f; > c.UseBorderPadding = true; > c.UseAscender = true; > c.UseDescender = true; > table.AddCell(c); > > table.AddCell("2.1"); > table.AddCell("3.1"); > table.AddCell("1.2"); > table.AddCell("2.2"); > table.AddCell("3.2"); > > -------------------- > > Thanks, > > -Mitch > > -----Original Message----- > From: Paulo Soares [mailto:[EMAIL PROTECTED] > Sent: Wednesday, November 02, 2005 8:52 AM > To: Mitch Freed; [email protected] > Subject: RE: [iText-questions] PdfPTable Cell Borders > > With normal borders the border will cover half width the cell and the > other half width the adjacent cell or the outside of the table. That's > why you have that discontinuity. That also why you shouldn't > mix modes. > > > -----Original Message----- > > From: Mitch Freed [mailto:[EMAIL PROTECTED] > > Sent: Wednesday, November 02, 2005 3:40 PM > > To: Paulo Soares; [email protected] > > Subject: RE: [iText-questions] PdfPTable Cell Borders > > > > Thanks, for clarifying variable borders. > > > > But, if a normal border will paint the border in the cell > boundaries, > > what is causing the first example I posted at the beginning of this > > thread to paint the border outside the cell boundary? Maybe I don't > > understand the boundary of the cell, but it doesn't seem to be > > working. > > > > -Mitch > > > > -----Original Message----- > > From: Paulo Soares [mailto:[EMAIL PROTECTED] > > Sent: Wednesday, November 02, 2005 8:24 AM > > To: Mitch Freed; [email protected] > > Subject: RE: [iText-questions] PdfPTable Cell Borders > > > > Variable borders paint the border inside the cell whereas normal > > borders paint the border in the cell boundaries. Let's say we have a > > 1 pt border > > and two cell, one on top of the other that we'll call cell1 for the > > top one and cell2 for the bottom one. With variable borders > the 1 pt > > border will be inside each cell and in the place that the two cells > > join there's 1 pt border for cell1 and 1 pt border for > cell2 with the > > result of a visible 2 pt border. With normal borders the border of > > cell2 will be on top of the border of cell1 with the result > that the > > visible width will be 1 pt. > > > > > -----Original Message----- > > > From: [EMAIL PROTECTED] > > > [mailto:[EMAIL PROTECTED] On Behalf Of > > > Mitch Freed > > > Sent: Wednesday, November 02, 2005 3:08 PM > > > To: [email protected] > > > Subject: RE: [iText-questions] PdfPTable Cell Borders > > > > > > I'm not sure if I am using useVariableBorders() > correctly, or what, > > > but if I set useVariableBorders for the cell with the > > different border > > > > > width, the outside of the table doesn't line up with the > cell (see > > > cell_variableborders.pdf). If I turn on variableBorders > for all the > > > cells, I get double borrder on the cells (see > > > all_variableborders.pdf). Is there something else that > > needs to happen > > > > > to get the borders to work with a cell with a different > border like > > > this? > > > > > > ________________________________ > > > > > > > > > [C#] > > > > > > PdfPTable table = new PdfPTable(new float[] {1f,1f,1f}); > > > table.DefaultCell.UseAscender = true; > > > table.DefaultCell.UseDescender = true; > > > table.DefaultCell.UseVariableBorders = true; > > > > > > PdfPCell header = new PdfPCell(); > > > header.AddElement(new Chunk("header with colspan 3")); > > header.Colspan > > > = 3; header.UseAscender = true; header.UseDescender = true; > > > header.UseVariableBorders = true; table.AddCell(header); > > > > > > PdfPCell c = new PdfPCell(); > > > c.AddElement(new Chunk("1.1")); > > > c.BorderWidth = 10f; > > > c.UseBorderPadding = true; > > > c.UseAscender = true; > > > c.UseDescender = true; > > > c.UseVariableBorders = true; > > > table.AddCell(c); > > > > > > table.AddCell("2.1"); > > > table.AddCell("3.1"); > > > table.AddCell("1.2"); > > > table.AddCell("2.2"); > > > table.AddCell("3.2"); > > > > > > ________________________________ > > > > > > > > > Thanks, > > > > > > -Mitch > > > > > > > > > ________________________________ > > > > > > From: [EMAIL PROTECTED] > > > [mailto:[EMAIL PROTECTED] On Behalf Of > > > Mitch Freed > > > Sent: Tuesday, November 01, 2005 1:33 PM > > > To: [email protected] > > > Subject: RE: [iText-questions] PdfPTable Cell Borders > > > > > > > > > Just found it -- useVariableBorders(bool) > > > > > > Thanks, > > > > > > -Mitch > > > > > > > > > ________________________________ > > > > > > From: [EMAIL PROTECTED] > > > [mailto:[EMAIL PROTECTED] On Behalf Of > > > Mitch Freed > > > Sent: Tuesday, November 01, 2005 1:17 PM > > > To: [email protected] > > > Subject: [iText-questions] PdfPTable Cell Borders > > > > > > > > > I have a table(PdfPTable) using a border and have specified > > one cell > > > to use a large border width. I have the BorderPadding set to True > > > (setUseBorderPadding), which sets the padding to include > the border > > > width -- that's working great. The border of the cell > > however, moves > > > into and outside of the table's area (it's an outside > cell in this > > > case). Is there anyway to tell the table or cell to keep > the border > > > within the cell? I am attaching the example pdf and code. > > > > > > ________________________________ > > > > > > > > > [C#] > > > > > > PdfPTable table = new PdfPTable(new float[] {1f,1f,1f}); > > > table.DefaultCell.UseAscender = true; > > table.DefaultCell.UseDescender = > > > > > true; > > > > > > PdfPCell header = new PdfPCell(); > > > header.AddElement(new Chunk("header with colspan 3")); > > header.Colspan > > > = 3; header.UseAscender = true; header.UseDescender = true; > > > table.AddCell(header); > > > > > > PdfPCell c = new PdfPCell(); > > > c.AddElement(new Chunk("1.1")); > > > c.BorderWidth = 10f; > > > c.UseBorderPadding = true; > > > c.UseAscender = true; > > > c.UseDescender = true; > > > table.AddCell(c); > > > > > > table.AddCell("2.1"); > > > table.AddCell("3.1"); > > > table.AddCell("1.2"); > > > table.AddCell("2.2"); > > > table.AddCell("3.2"); > > > > > > ________________________________ > > > > > > > > > Thanks, > > > Mitch Freed > > > [EMAIL PROTECTED] > > > > > > ------------------------------------------------------- SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions
