Exemple #1
0
        private void WriteDataValue(DIExcel excelFile, Question xmlQuestion, ref int dataValueRowIndex)
        {
            string[] SelectedValues = null;
            int      Index          = 0;

            switch (xmlQuestion.AnswerType)
            {
            case AnswerType.TB:
            case AnswerType.TBN:
            case AnswerType.RB:
            case AnswerType.CB:
            case AnswerType.DateType:
                excelFile.SetCellValue(Constants.SheetIndex, dataValueRowIndex, Constants.DataValueColumnIndex, xmlQuestion.DataValue);
                break;

            case AnswerType.SCB:
            case AnswerType.SRB:
                break;

            case AnswerType.CH:
                SelectedValues = DICommon.SplitStringNIncludeEmpyValue(xmlQuestion.DataValue, ",");
                foreach (AnswerTypeOption Option in xmlQuestion.Options)
                {
                    excelFile.GetCellFont(Constants.SheetIndex, dataValueRowIndex, Constants.DataValueColumnIndex).Name = "Wingdings";

                    if (SelectedValues[Index] == "1")
                    {
                        excelFile.SetCellValue(Constants.SheetIndex, dataValueRowIndex, Constants.DataValueColumnIndex, Char.ConvertFromUtf32(252));
                    }
                    else
                    {
                        excelFile.SetCellValue(Constants.SheetIndex, dataValueRowIndex, Constants.DataValueColumnIndex, Char.ConvertFromUtf32(251));
                    }


                    excelFile.SetCellValue(Constants.SheetIndex, dataValueRowIndex, Constants.DataValueColumnIndex + 1, Option.Text);
                    dataValueRowIndex += 1;
                    Index             += 1;
                }
                break;

            case AnswerType.GridType:
                int StartRowIndex = dataValueRowIndex;
                int EndRowIndex;
                int EndColIndex;
                excelFile.LoadDataTableIntoSheet(dataValueRowIndex, Constants.DataValueColumnIndex, xmlQuestion.GridTable, Constants.SheetIndex, true);
                dataValueRowIndex += xmlQuestion.GridTable.Rows.Count;
                EndRowIndex        = dataValueRowIndex - 1;
                EndColIndex        = Constants.DataValueColumnIndex + xmlQuestion.GridTable.Columns.Count - 1;
                excelFile.SetRangeBorder(Constants.SheetIndex, StartRowIndex, Constants.DataValueColumnIndex, EndRowIndex, EndColIndex,
                                         SpreadsheetGear.LineStyle.Continous, SpreadsheetGear.BorderWeight.Thin, System.Drawing.Color.Black, SpreadsheetGear.BordersIndex.InsideHorizontal);
                excelFile.SetRangeBorder(Constants.SheetIndex, StartRowIndex, Constants.DataValueColumnIndex, EndRowIndex, EndColIndex,
                                         SpreadsheetGear.LineStyle.Continous, SpreadsheetGear.BorderWeight.Thin, System.Drawing.Color.Black, SpreadsheetGear.BordersIndex.InsideVertical);
                excelFile.SetRangeBorder(Constants.SheetIndex, StartRowIndex, Constants.DataValueColumnIndex, EndRowIndex, EndColIndex,
                                         SpreadsheetGear.LineStyle.Continous, SpreadsheetGear.BorderWeight.Thin, System.Drawing.Color.Black, SpreadsheetGear.BordersIndex.EdgeBottom);
                excelFile.SetRangeBorder(Constants.SheetIndex, StartRowIndex, Constants.DataValueColumnIndex, EndRowIndex, EndColIndex,
                                         SpreadsheetGear.LineStyle.Continous, SpreadsheetGear.BorderWeight.Thin, System.Drawing.Color.Black, SpreadsheetGear.BordersIndex.EdgeTop);
                excelFile.SetRangeBorder(Constants.SheetIndex, StartRowIndex, Constants.DataValueColumnIndex, EndRowIndex, EndColIndex,
                                         SpreadsheetGear.LineStyle.Continous, SpreadsheetGear.BorderWeight.Thin, System.Drawing.Color.Black, SpreadsheetGear.BordersIndex.EdgeLeft);
                excelFile.SetRangeBorder(Constants.SheetIndex, StartRowIndex, Constants.DataValueColumnIndex, EndRowIndex, EndColIndex,
                                         SpreadsheetGear.LineStyle.Continous, SpreadsheetGear.BorderWeight.Thin, System.Drawing.Color.Black, SpreadsheetGear.BordersIndex.EdgeRight);


                break;

            case AnswerType.Calculate:
                break;

            case AnswerType.Aggregate:
                break;

            default:
                break;
            }
        }