Setting the data type of a cell

Jan 23, 2013 at 7:35 PM
Edited Jan 23, 2013 at 7:35 PM

I am brand new to C# and NPOI, so bare with me.

I am trying to set the cells for all numbers to 'number' in Excel.  

I have a method CreateExcel().  The styles are being created like this:

ICellStyle styAnswer = wb.CreateCellStyle();
styAnswer.BorderBottom = CellBorderType.MEDIUM;
styAnswer.BottomBorderColor =HSSFColor.GREY_40_PERCENT.index;
styAnswer.BorderTop = CellBorderType.MEDIUM;
styAnswer.TopBorderColor = HSSFColor.GREY_40_PERCENT.index;
styAnswer.BorderLeft = CellBorderType.MEDIUM;
styAnswer.LeftBorderColor = HSSFColor.GREY_40_PERCENT.index;
styAnswer.BorderRight = CellBorderType.MEDIUM;
styAnswer.RightBorderColor = HSSFColor.GREY_40_PERCENT.index;
styAnswer.WrapText = true;
styAnswer.FillForegroundColor = HSSFColor.YELLOW.index;
styAnswer.FillPattern = FillPatternType.SOLID_FOREGROUND;
styAnswer.WrapText = true;
styAnswer.SetFont(normalFont);
styAnswer.Alignment = HorizontalAlignment.CENTER;
styAnswer.VerticalAlignment = VerticalAlignment.CENTER;
The data type is then specified in a
foreach (SurveyQuestionEntity question in surveyDataModel.Questions)
{
    switch ((AnswerType)question.AnswerTypeId)
    {
        case AnswerType.Number:
        {
                //Where i Assume the code will go
                break;
         }
    }
}

How do I accomplish this