private Table CreateFreeResponseOfTextbox(QuestionVM question) { ResponseVM response = question.Response; FreeLayoutVM freeLayout = (FreeLayoutVM)response.Layout; //Create table with border int realRowCount = GetRealRowCount(freeLayout.RowCount); int realColumnCount = GetRealColumnCount(freeLayout.ColumnCount); Table table = CreateDefaultTable(); TableRow tableRow = new TableRow(); table.Append(tableRow); //Create one cell int cellWidth = CalcBoxCellWidth(realColumnCount); TableCell tableCell = CreateBorderCell(cellWidth); tableRow.Append(tableCell); for (int r = 0; r < realRowCount - 1; r++) //reduce one row because of the one that has been added { //The paragraph in the number of the number of lines in it tableCell.Append(CreateEmptyParagraph()); } return(table); }
private Table CreateFreeResponseOfBox(QuestionVM question) { ResponseVM response = question.Response; FreeLayoutVM freeLayout = (FreeLayoutVM)response.Layout; int realRowCount = GetRealRowCount(freeLayout.RowCount); int realColumnCount = GetRealColumnCount(freeLayout.ColumnCount); return(CreateTable(realRowCount, realColumnCount)); }
private Table CreateFreeResponseOfUnderline(QuestionVM question) { ResponseVM response = question.Response; FreeLayoutVM freeLayout = (FreeLayoutVM)response.Layout; //Create table with only horizontal line, no border int realRowCount = GetRealRowCount(freeLayout.RowCount); int realColumnCount = GetRealColumnCount(freeLayout.ColumnCount); Table table = CreateDefaultTable(); int cellWidth = CalcBoxCellWidth(realColumnCount); for (int r = 0; r < realRowCount; r++) { //Create a cell with no right and left border TableRow tableRow = new TableRow(); table.Append(tableRow); TableCell tableCell = CreateUnderlineCell(cellWidth); tableRow.Append(tableCell); } return(table); }
private void WriteFreeResponse(Body body, QuestionVM question) { ResponseVM response = question.Response; FreeLayoutVM freeLayout = (FreeLayoutVM)response.Layout; if (freeLayout.Style == LayoutStyle.Underline) { //Underline Table table = CreateFreeResponseOfUnderline(question); body.Append(table); } else if (freeLayout.Style == LayoutStyle.Box) { //squares(normal table) Table table = CreateFreeResponseOfBox(question); body.Append(table); } else if (freeLayout.Style == LayoutStyle.Textbox) { //textbox (table without border) Table table = CreateFreeResponseOfTextbox(question); body.Append(table); } }