Advertisement
Guest User

Untitled

a guest
Feb 16th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.12 KB | None | 0 0
  1.   public static PdfPTable PDFTableCreator(QuestionDTO question, int questionNumber)
  2.         {
  3.             GetEmptySquare();
  4.             PdfPTable table = new PdfPTable(2)
  5.             {
  6.                 KeepTogether = true,
  7.                 WidthPercentage = 100,
  8.             };
  9.             table.SetWidths(new float[] { 1f, 12f });
  10.  
  11.             table.AddCell(new PdfPCell(new Paragraph(questionNumber + ". " + question.QuestionText, _polishFont))
  12.             {
  13.                 Border = _border,
  14.                 Colspan = 2,
  15.                 HorizontalAlignment = Element.ALIGN_LEFT
  16.             });
  17.  
  18.             foreach (var answer in question.AnswersDTO)
  19.             {
  20.                 table.AddCell(new PdfPCell(GetEmptySquare())
  21.                 {
  22.                     Border = _border,
  23.                     HorizontalAlignment = Element.ALIGN_CENTER,
  24.                     Padding = 4
  25.                 });
  26.                 table.AddCell(new PdfPCell(new Paragraph(answer.TextAnswer, _polishFont))
  27.                 {
  28.                     Border = _border,
  29.                 });
  30.             }
  31.             return table;
  32.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement