예제 #1
0
        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);
        }
예제 #2
0
        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));
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
            }
        }