//Adding DataRow foreach (DataGridViewRow row in ListDataGridView.Rows) { int c = 0; foreach (DataGridViewCell cell in row.Cells) { if (c == 2) { PdfPCell cell2 = new PdfPCell(new Phrase(cell.Value.ToString().Split(' ')[0], calibri)); pdfTable.AddCell(cell2); } else { PdfPCell cell2 = new PdfPCell(new Phrase(cell.Value.ToString(), calibri)); cell2.HorizontalAlignment = Element.ALIGN_RIGHT; cell2.VerticalAlignment = Element.ALIGN_CENTER; pdfTable.AddCell(cell2); } c++; } }
System.Globalization.CultureInfo ci = System.Globalization.CultureInfo.InvariantCulture; DateTime d = DateTime.ParseExact("16.04.2020 00:00:00", "dd.MM.yyyy HH:mm:ss", ci); Console.WriteLine(d.ToString()); //produces: 16.04.2020 00:00:00 Console.WriteLine(d.ToString("dd.MM.yyyy")); //produces: 16.04.2020
PdfPCell cell2 = new PdfPCell(new Phrase(cell.Value.ToString().Split(' ')[0], calibri)); PdfPCell cell2 = new PdfPCell(new Phrase(cell.Value.ToString("dd.MM.yyyy"), calibri));
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)