In Java, I would instantiate the cell and disable the border of the cell
with:
cell.setBorder(Rectangle.NO_BORDER);
before returning it within your method
private PdfPCell NewCell(string text, FaxFonts font, int colspan)
{
return new PdfPCell(new Phrase(text,
_fonts[(int)font].Font)) { Colspan = colspan };
}
Op 30/06/2011 13:18, hhn000 schreef:
It seems that the problem is that I'm using new PDFPCell to create the
new cell instead of using AddCell(Phrase), so it doesn't know about
the table.
But if I create the new cell from table.DefaultCell, doesn't it create
a copy of the table? which gets thrown away when adding the cell with
AddCell(PDFPCell).
The easiest solution would be if AddCell(Phrase) returned the newly
added cell, so I could adjust the colspan... but then AddCell looks to
need to know about it when adding the cell...
Some kind of factory method that returns a PDFPCell suitable for
addition with AddCell() without any unnecessary overhead would be nice.
Did I miss something? Or do something in a wrong way?
On Thu, Jun 30, 2011 at 09:42, hhn000 <hhn...@gmail.com
<mailto:hhn...@gmail.com>> wrote:
Does anyone have any ideas about the problem? I have checked the
source, but I can't see any difference between AddCell(string) and
AddCell(new PDFPCell(new Phrase(string, font). If so, the only
change is the Colspan, I haven't checked the generation from the
table, but there doesn't seem to be any obvious reason why that
would affect the borders (at least to me without reading the code).
Any help would be much appreciated.
On Wed, Jun 29, 2011 at 11:14, hhn000 <hhn...@gmail.com
<mailto:hhn...@gmail.com>> wrote:
Ok, I'm adding the rows using the following code:
public void DrawBlock(ITextColumns block)
{
var table = new PdfPTable(block.Widths);
table.WidthPercentage = 100f;
table.DefaultCell.Border = Rectangle.NO_BORDER;
AddRows(table, block.Spans1, block.Rows1,
block.Fonts);
AddRows(table, block.Spans2, block.Rows2,
block.Fonts);
_document.Add(table);
}
private void AddRows(PdfPTable table, int[] spans,
List<string[]> rows, FaxFonts[] fonts)
{
foreach (var row in rows)
{
var j = 0;
for (var i = 0; i < spans.Length; i++)
if (spans[i] > 0)
{
table.AddCell(NewCell(row[j],
fonts[i], spans[i]));
j++;
}
}
}
private PdfPCell NewCell(string text, FaxFonts font,
int colspan)
{
return new PdfPCell(new Phrase(text,
_fonts[(int)font].Font)) { Colspan = colspan };
}
In AddRows spans look like { 1, 1, 1, 1, 1, 1 } or { 4, 0, 0,
0, 1, 1 }
Each row like { "col1", "col2", "col3", "col4", "col5", "col6"
} or { "col1", "col2", "col3", "col4" } for the above spans.
IIRC i was using table.AddCell(row[i]) when it didn't show the
borders earlier.
On Wed, Jun 29, 2011 at 10:47, 1T3XT BVBA <i...@1t3xt.info
<mailto:i...@1t3xt.info>> wrote:
On 29/06/2011 9:24, hhn000 wrote:
>
> Does anyone have any idea of what I'm doing wrong?
We don't have sufficient information to answer that question.
1. You say that you initially turned borders off and it
worked.
2. Then you turned them on and it worked.
3. Now you turned them back off and it no longer works.
We don't know what else you changed in 2.
Maybe you've started working with PdfPCell objects instead
of just the
addCell() method.
Only you know, so we don't have the answer: you have.
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is
seriously valuable.
Why? It contains a definitive record of application
performance, security
threats, fraudulent activity, and more. Splunk takes this
data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
<mailto:iText-questions@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/itext-questions
iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be
answered with a reference to the iText book:
http://www.itextpdf.com/book/
Please check the keywords list before you ask for
examples: http://itextpdf.com/themes/keywords.php
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php