में शीर्षलेख के रूप में PdfPTable मुझे शीर्षलेख के रूप में प्रदर्शित करने के लिए लगभग 12 कक्षों वाली एक तालिका की आवश्यकता है। निम्नलिखित कोड ऐसा करने में विफल रहता है। मुझे पता है टेबल 2 में 12 सेल्स नहीं हैं। दूसरे पृष्ठ पर, केवल "परीक्षण" प्रदर्शित होता है। मैं क्या खो रहा हूँ?iTextSharp
अग्रिम धन्यवाद!
Document document = new Document();
try
{
PdfWriter.GetInstance(document, new FileStream("TableTest.pdf", FileMode.Create));
document.Open();
PdfPTable table = new PdfPTable(1);
table.WidthPercentage = 100;
PdfPTable table2 = new PdfPTable(2);
//logo
PdfPCell cell2 = new PdfPCell(Image.GetInstance(@"C:\path\to\file.gif"));
cell2.Colspan = 2;
table2.AddCell(cell2);
//title
cell2 = new PdfPCell(new Phrase("\nTITLE TEXT", new Font(Font.HELVETICA, 16, Font.BOLD | Font.UNDERLINE)));
cell2.HorizontalAlignment = Element.ALIGN_CENTER;
cell2.Colspan = 2;
table2.AddCell(cell2);
PdfPCell cell = new PdfPCell(table2);
table.HeaderRows = 1;
table.AddCell(cell);
table.AddCell(new PdfPCell(new Phrase("")));
document.Add(table);
document.Add(new Phrase("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\ntesting"));
}
catch (DocumentException de)
{
Console.Error.WriteLine(de.Message);
}
catch (IOException ioe)
{
Console.Error.WriteLine(ioe.Message);
}
document.Close();