skanoko siame

skanoko siame

  • NA
  • 25
  • 595

whats missing im using itext sharp to export wpf grid to pdf

Mar 22 2019 5:34 AM
PdfPTable table = new PdfPTable(dataGridCst.Columns.Count);
//Table header
BaseFont btnColumnHeader = BaseFont.CreateFont(BaseFont.TIMES_ROMAN, BaseFont.CP1252, BaseFont.NOT_EMBEDDED);
iTextSharp.text.Font fntColumnHeader = new iTextSharp.text.Font(btnColumnHeader, 10, 1, BaseColor.WHITE);
for (int i = 0; i < dataGridCst.Columns.Count; i++)
{
PdfPCell cell = new PdfPCell();
cell.BackgroundColor = BaseColor.GRAY;
cell.AddElement(new Chunk(dataGridCst.Columns[i], fntColumnHeader));// <<<< keeps showing a red line
table.AddCell(cell);
}
//table Data
for (int i = 0; i < dataGridCst.Items.Count; i++)
{
for (int j = 0; j < dataGridCst.Columns.Count; j++)
{
table.AddCell(dataGridCst.Items.ToString());
}
}

Answers (1)