在特定行后跳过额外的一行

Skip an extra line after particular row

我有一个 table,它有 3 列,大约有 10 行。但是我想做的是在特定行之后跳过额外的一行。

这是我的代码;

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 });

我得到这样的输出;

Responsibilities Held           : Blah bluh bluh bluh bluh ............................
                                  bluh ..........bluh ...

Description of Work Done        : Blu....................................h..............
                                  bluh.........................

Present Address                 : Blu....................................h..............
                                  bluh.........................Extra space after here

Additional Qualifications       : Blu....................................h..............
                                  bluh.........................

我想在现在的地址

之后添加额外的space

请帮帮我.... 谢谢

您可以像这样使用 PaddingBottom 作为单元格 属性。

new PdfPCell(new Phrase("Responsibilities Held ", other)) { BorderWidth = 0, PaddingBottom = 10f }

如果您想在两行之间添加一些额外的 space,为什么不添加一个具有固定高度的额外(空)行?

我使用了将两行添加到 table 的代码片段,并在这两行之间添加了一个 colspan 为 3 的额外单元格。我将这行的高度定义为 30 个用户单位(对应 30 个点):

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 });

PdfPCell cell = new PdfPCell();
cell.Colspan = 3;
cell.FixedHeight = 30.0f;
third_table.AddCell(cell);

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 });