First off I\'m not that great with C# and it\'s been a while since I\'ve worked with it..
I\'m making a windows form for a friend that delivers packages. So I want t
You're passing a String
and a Font
to the AddCell()
method. That's not going to work. You need the AddCell()
method that takes a Phrase
object or a PdfPCell
object as parameter.
A Phrase
is an object that consists of different Chunk
s, and the different Chunk
s can have different font sizes. Please read chapter 2 of my book for more info about this object.
Phrase phrase = new Phrase();
phrase.Add(
new Chunk("Some BOLD text", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD))
);
phrase.Add(new Chunk(", some normal text", new Font()));
table.AddCell(phrase);
A PdfPCell
is an object to which you can add different objects, such as Phrase
s, Paragraph
s, Image
s,...
PdfPCell cell = new PdfPCell();
cell.AddElement(new Paragraph("Hello"));
cell.AddElement(list);
cell.AddElement(image);
In this snippet list
is of type List
and image
is of type Image
.
The first snippet uses text mode; the second snippet uses composite mode. Cells behave very differently depending on the mode you use.
This is all explained in the documentation; you can find hundreds of C# examples here.