CKDT
CKDT

Reputation: 53

Define foreground color of a itextsharp table cell

I have a iTextSharp.text.Table and tried to change the foreground text color. But there is no method on the Cell object to define the color. Does anybody knows, where I can adjust the color?

Upvotes: 5

Views: 26275

Answers (2)

CKDT
CKDT

Reputation: 53

LnDCobras answerworked well.

My final solution is the following:

Font font = new Font(Font.HELVETICA, 11, new Color(255, 0, 0));
Chunk chunk = new Chunk("my Text", font);
Cell cell = new Cell(chunk);

table.AddCell(cell);

Upvotes: 0

Michal Ciechan
Michal Ciechan

Reputation: 13898

Try the following

    var FontColour = new BaseColor(31, 73, 125);
    var MyFont = FontFactory.GetFont("Times New Roman", 11, FontColour );
    table.AddCell(new Paragraph("My Text", MyFont));

Upvotes: 14

Related Questions