2015-02-11 47 views
0

我有一個有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......................... 

我想以後現住址,以增加額外的空間

請幫我.... 謝謝

+0

@DKKoch避免編輯會改變含義。插入只是跳過。 – SimpleVar 2015-02-11 06:27:39

+2

如果您希望我們能夠了解您的情況,您必須告訴我們您的期望和目前正在獲得的信息。 – SimpleVar 2015-02-11 06:28:36

+0

我是這樣得出來的; – 2015-02-11 06:45:53

回答

1

如果您想在兩行之間添加一些額外的空間,爲什麼不添加一個固定高度的額外(空)行?

我把你的代碼片斷添加到表中的兩行,並且我在這兩行之間添加了一個帶有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 }); 
0

您可以使用paddingBottom來作爲細胞性質是這樣的。

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