I am adding a table to a PDF file. I have 3 rows and 3 columns. I want the first column to appear only once as a single cell for all the rows. The result should be like where it says Deloitte in the column of company as shown in the image:
The MyFirstTable example from iText in Action (second edition) does exactly what you need. Ported to C#, it looks like this:
PdfPTable table = new PdfPTable(3); // the cell object PdfPCell cell; // we add a cell with colspan 3 cell = new PdfPCell(new Phrase("Cell with colspan 3")); cell.Colspan = 3; table.AddCell(cell); // now we add a cell with rowspan 2 cell = new PdfPCell(new Phrase("Cell with rowspan 2")); cell.Rowspan = 2; table.AddCell(cell); // we add the four remaining cells with addCell() table.AddCell("row 1; cell 1"); table.AddCell("row 1; cell 2"); table.AddCell("row 2; cell 1"); table.AddCell("row 2; cell 2");
In your case you'd need
cell.Rowspan = 6; for the cell with value Deloitte.
Click this link if you want to see how to answer this question in iText 7.