我做了一个非常简单的报告。我希望在整个文档中保持相同的对齐方式。
问题;
Reference No : MP014
Present Address : blah blah ...........................................blah
blah...blah......
但我希望它是这样的。
Reference No : MP014
Present Address : blah blah ...........................................blah
blah...blah......
这是我使用的代码。请帮帮我
first.AddCell(new PdfPCell(new Phrase("ID No", other)) { BorderWidth = 0 });
first.AddCell(new PdfPCell(new Phrase(": " + id, other)) { BorderWidth = 0 });
first.AddCell(new PdfPCell(new Phrase("Present Address", other)) { BorderWidth = 0 });
first.AddCell(new PdfPCell(new Phrase(": " + present_address, other)) { BorderWidth = 1 });
答案 0 :(得分:0)
您可以通过引入额外的列来解决此问题:
Paragraph paragraphTable3 = new Paragraph();
paragraphTable3.SpacingBefore = 20f;
paragraphTable3.SpacingAfter = 10f;
PdfPTable third_table = new PdfPTable(3);
third_table.TotalWidth = 560f;
third_table.LockedWidth = true;
third_table.SetWidths(new float[] { 2.4f,0.1f, 6.6f });
third_table.AddCell(new PdfPCell(new Phrase("Responsibilities Held ", other)) { BorderWidth = 0 });
third_table.AddCell(new PdfPCell(new Phrase(": ", other)) { BorderWidth = 0 });
third_table.AddCell(new PdfPCell(new Phrase( Responsibilities_held, other)) { BorderWidth = 0 });
third_table.AddCell(new PdfPCell(new Phrase("Description of Work Done", other)) { BorderWidth = 0 });
third_table.AddCell(new PdfPCell(new Phrase(": ", other)) { BorderWidth = 0 });
third_table.AddCell(new PdfPCell(new Phrase( Description_of_work_done, other)) { BorderWidth = 0 });
document.Add(third_table);