question

MalamMalam-4042 avatar image
0 Votes"
MalamMalam-4042 asked MalamMalam-4042 answered

Write to pdf with 2 Cells in the Same Line using iTextSharp

The following code writes Name and then Department in the next line right below the Name.
How do I modify this code to write Department in the same line with a Tab separator?

                 table.AddCell(PhraseCell(new Phrase("Name:", FontFactory.GetFont("Arial", 8, iTextSharp.text.Font.BOLD, BaseColor.BLACK)), PdfPCell.ALIGN_LEFT));
                 table.AddCell(PhraseCell(new Phrase(name, FontFactory.GetFont("Arial", 8, iTextSharp.text.Font.NORMAL, BaseColor.BLACK)), PdfPCell.ALIGN_LEFT));
                 cell = PhraseCell(new Phrase(), PdfPCell.ALIGN_CENTER);
                 cell.Colspan = 2;
                 cell.PaddingBottom = 10f;
                 table.AddCell(cell);
    
                 table.AddCell(PhraseCell(new Phrase("Department:", FontFactory.GetFont("Arial", 8, iTextSharp.text.Font.BOLD, BaseColor.BLACK)), PdfPCell.ALIGN_LEFT));
                 table.AddCell(PhraseCell(new Phrase("HCVP Voucher Program", FontFactory.GetFont("Arial", 8, iTextSharp.text.Font.NORMAL, BaseColor.BLACK)), PdfPCell.ALIGN_LEFT));
                 cell = PhraseCell(new Phrase(), PdfPCell.ALIGN_CENTER);
                 cell.Colspan = 2;
                 cell.PaddingBottom = 10f;
                 table.AddCell(cell);


dotnet-aspnet-webforms
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

MalamMalam-4042 avatar image
0 Votes"
MalamMalam-4042 answered

Never mind!
I've fixed it with:

cell.Rowspan = 4;

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.