- private void button2_Click(object sender, EventArgs e)
- {
-
- PdfPTable pdfTable = new PdfPTable(testtableDataGridView.ColumnCount);
- pdfTable.DefaultCell.Padding = 3;
- pdfTable.WidthPercentage = 100;
- pdfTable.HorizontalAlignment = Element.ALIGN_LEFT;
- pdfTable.DefaultCell.BorderWidth = 1;
- pdfTable.DefaultCell.BorderWidth = 1;
-
- float[] sirina = new float[] { 50f, 90f, 45f, 40f, 40f };
- 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, 10);
-
-
- foreach (DataGridViewColumn column in testtableDataGridView.Columns)
- {
- PdfPCell cell = new PdfPCell(new Phrase(column.HeaderText, calibri));
- cell.BackgroundColor = new iTextSharp.text.BaseColor(240, 240, 240);
- pdfTable.AddCell(cell);
- }
-
-
- foreach (DataGridViewRow row in testtableDataGridView.Rows)
- {
-
- foreach (DataGridViewCell cell in row.Cells)
- {
- string yourDateString = testtableDataGridView.Rows[row][dataGridViewTextBoxColumn12].ToString("dd/MM/yyyy");
- PdfPCell cell2 = new PdfPCell(new Phrase(new Chunk(DateTime.Parse(yourDateString).ToShortDateString(), calibri)));
-
- pdfTable.AddCell(cell2);
- }
- }
-
-
-
-
- string folderPath = "C:\\PDFs\\";
- if (!Directory.Exists(folderPath))
- {
- Directory.CreateDirectory(folderPath);
- }
- using (FileStream stream = new FileStream(folderPath + "Ulazni racun roba.pdf", FileMode.Create))
- {
- iTextSharp.text.Font calibriTitle = new iTextSharp.text.Font(bfCalibri, 12);
- iTextSharp.text.Font calibriSubTitle = new iTextSharp.text.Font(bfCalibri, 10);
- 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 + "Ulazni racun roba.pdf");
-
- }
-
- }
Error is line 30 Rows.row here... Severity Code Description Project File Line Suppression State
Error CS1503 Argument 1: cannot convert from 'System.Windows.Forms.DataGridViewRow' to 'int'