Настройка типа столбца ITEXTSHARP C#?
I have problem with output result... Column have value 16.2.2018 00:00:00 I need value 16.2.2018 Sql column type is DATETIME In another column have type DATE and same problem Need help
Что я уже пробовал:
private void button2_Click(object sender, EventArgs e) //pdf print button { //Creating iTextSharp Table from the DataTable data //Console.WriteLine(drzaveDataGridView.ColumnCount); test za itext sharp PdfPTable pdfTable = new PdfPTable(mktestprobaDataGridView.ColumnCount); pdfTable.DefaultCell.Padding = 3; pdfTable.WidthPercentage = 100; pdfTable.HorizontalAlignment = Element.ALIGN_LEFT; pdfTable.DefaultCell.BorderWidth = 1; float[] sirina = new float[] { 20f, 25f, 45f, 56f, 43f }; pdfTable.SetWidths(sirina); BaseFont bfCalibri = BaseFont.CreateFont("c:\\windows\\fonts\\calibri.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED); iTextSharp.text.Font calibri = new iTextSharp.text.Font(bfCalibri, 8); //Adding Header row foreach (DataGridViewColumn column in mktestprobaDataGridView.Columns) { PdfPCell cell = new PdfPCell(new Phrase(column.HeaderText)); //cell.BackgroundColor = new iTextSharp.text.Color(240, 240, 240); pdfTable.AddCell(cell); } //Adding DataRow foreach (DataGridViewRow row in mktestprobaDataGridView.Rows) { foreach (DataGridViewCell cell in row.Cells) { pdfTable.AddCell(cell.Value.ToString()); } } //Exporting to PDF string folderPath = "C:\\PDFs\\"; if (!Directory.Exists(folderPath)) { Directory.CreateDirectory(folderPath); } using (FileStream stream = new FileStream(folderPath + "Drzave.pdf", FileMode.Create)) { iTextSharp.text.Font calibriTitle = new iTextSharp.text.Font(bfCalibri, 18); iTextSharp.text.Font calibriSubTitle = new iTextSharp.text.Font(bfCalibri, 14); Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 10f, 0f); PdfWriter.GetInstance(pdfDoc, stream); pdfDoc.Open(); // pdfDoc.Add(new Paragraph(korisnik_programa)); // pdfDoc.Add(new Paragraph(adresa)); pdfDoc.Add(pdfTable); pdfDoc.Close(); stream.Close(); System.Diagnostics.Process.Start(folderPath + "Drzave.pdf"); } }