Define foreground color of a itextsharp table cell

房东的猫 提交于 2019-12-05 17:06:16

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));
CKDT

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);
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!