C# itextsharp转到下一行带有空格的桌子
我正在做一个非常简单的报告。我希望在整个文档中保持相同的对齐方式 问题C# itextsharp转到下一行带有空格的桌子,c#,.net,itextsharp,itext,C#,.net,Itextsharp,Itext,我正在做一个非常简单的报告。我希望在整个文档中保持相同的对齐方式 问题 Reference No : MP014 Present Address : blah blah ...........................................blah blah...blah...... 但我希望它是这样的 Reference No : MP014 Present Address : blah bl
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 });
您可以通过引入一个额外的列来解决此问题:
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);
为什么不使用一个有三列的表呢?中间的列是带有以下内容的列:?或者,为什么不在第一列中添加:使用特殊的胶水块与右侧对齐?解决这个问题的方法不止一种。非常感谢。我被困在两个牢房里,我正在添加一个答案供进一步参考。