1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
private void creerPdf_Click(object sender, RoutedEventArgs e)
{
Document doc = new Document(iTextSharp.text.PageSize.LETTER, 10, 10, 42, 35);
PdfWriter wr = PdfWriter.GetInstance(doc, new FileStream("Dossier_pdf", FileMode.Create));
doc.Open();
//Paragraph prg = new Paragraph("test de création de doc pdf...");
//doc.Add(prg);
//doc.Close();
PdfPTable table = new PdfPTable(dmdSatisfaitesDTGrid.Columns.Count);
//for (int j=0; j < dmdSatisfaitesDTGrid.Columns.Count; j++)
//{
// table.AddCell(
//}
//doc.Add(table);
//}
BaseFont btnColumnHeader = BaseFont.CreateFont(BaseFont.TIMES_ROMAN, BaseFont.CP1252, BaseFont.NOT_EMBEDDED);
//Font fntColumnHeader = new Font(btnColumnHeader, 10, 1, Color.WHITE);
for (int i = 0; i < dmdSatisfaitesDTGrid.Columns.Count; i++)
{
PdfPCell cell = new PdfPCell();
//cell.AddElement(new Chunk(dmdSatisfaitesDTGrid.Columns[i].Header));
table.AddCell(cell);
}
for (int i = 0; i < dmdSatisfaitesDTGrid.Columns.Count; i++)
{
table.AddCell(dmdSatisfaitesDTGrid.Columns[i].ToString());
}
doc.Add(table);
doc.Close();
wr.Close();
} |
Partager