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 DATE
Need help
- private void button2_Click(object sender, EventArgs e)
- {
-
-
- 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);
-
-
-
- foreach (DataGridViewColumn column in mktestprobaDataGridView.Columns)
- {
- PdfPCell cell = new PdfPCell(new Phrase(column.HeaderText));
-
- pdfTable.AddCell(cell);
- }
-
-
- foreach (DataGridViewRow row in mktestprobaDataGridView.Rows)
- {
-
- foreach (DataGridViewCell cell in row.Cells)
- {
- pdfTable.AddCell(cell.Value.ToString());
- }
- }
-
-
-
- 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(pdfTable);
- pdfDoc.Close();
- stream.Close();
- System.Diagnostics.Process.Start(folderPath + "Drzave.pdf");
- }
- }
-
Result
