2015-02-11 4 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......................... 

Я хочу, чтобы добавить дополнительное пространство после Present Адреса

Пожалуйста, помогите мне .... Спасибо

+0

@DrKoch Избегайте изменений, которые меняют смысл. Вставка - это ничего, кроме пропусков. – SimpleVar

+2

Вы должны будете рассказать нам, что вы ожидаете, и то, что вы сейчас получаете, если вы хотите, чтобы мы находились где-то ближе к пониманию вашей ситуации. – SimpleVar

+0

Я получаю это так; –

ответ

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 } 
Смежные вопросы