在 itextsharp 中更改文本样式

Change Text style in itextsharp

我想使用 itextsharp 将字体设为粗体。下面是我的代码

foreach (DataGridViewColumn column in dataGridView1.Columns)
{
      iTextSharp.text.pdf.BaseFont bf = iTextSharp.text.pdf.BaseFont.CreateFont(iTextSharp.text.pdf.BaseFont.TIMES_ROMAN, iTextSharp.text.pdf.BaseFont.CP1252, iTextSharp.text.pdf.BaseFont.EMBEDDED);

      //  iTextSharp.text.Font font1 = new iTextSharp.text.Font("iTextSharp.text.Font", 10, Font.Bold);
      //FontFactory.GetFont("TIMES_ROMAN", 10, Font.Bold);

      iTextSharp.text.Font font = new iTextSharp.text.Font(bf, 10);
      //iTextSharp.text.Font font = new iTextSharp.text.Font(9); 
      PdfPCell cell = new PdfPCell(new Phrase(column.HeaderText, font));
      cell.BackgroundColor = new iTextSharp.text.Color(240, 240, 240);                                  
      pdfTable.AddCell(cell);
}

iTextSharp.text.pdf.BaseFont.TIMES_ROMAN 更改为 iTextSharp.text.pdf.BaseFont.TIMES_BOLD 或使用任何其他已记录的方法来使用粗体。