예제 #1
0
        public override string ToString()
        {
            switch (CellType)
            {
            case CellType.Blank:
                return("");

            case CellType.Boolean:
                return(BooleanCellValue ? "TRUE" : "FALSE");

            case CellType.Error:
                return(ErrorEval.GetText(ErrorCellValue));

            case CellType.Formula:
                return(CellFormula);

            case CellType.Numeric:
                if (DateUtil.IsCellDateFormatted(this))
                {
                    FormatBase sdf = new SimpleDateFormat("dd-MMM-yyyy");
                    //sdf.setTimeZone(LocaleUtil.getUserTimeZone());
                    return(sdf.Format(DateCellValue));
                }
                return(NumericCellValue + "");

            case CellType.String:
                return(RichStringCellValue.ToString());

            default:
                return("Unknown Cell Type: " + CellType);
            }
        }
예제 #2
0
파일: XSSFCell.cs 프로젝트: zanhaipeng/npoi
        /// <summary>
        /// Returns a string representation of the cell
        /// </summary>
        /// <returns>Formula cells return the formula string, rather than the formula result.
        /// Dates are displayed in dd-MMM-yyyy format
        /// Errors are displayed as #ERR&lt;errIdx&gt;
        /// </returns>
        public override String ToString()
        {
            switch (CellType)
            {
            case CellType.BLANK:
                return("");

            case CellType.BOOLEAN:
                return(BooleanCellValue ? "TRUE" : "FALSE");

            case CellType.ERROR:
                return(ErrorEval.GetText(ErrorCellValue));

            case CellType.FORMULA:
                return(CellFormula);

            case CellType.NUMERIC:
                if (DateUtil.IsCellDateFormatted(this))
                {
                    FormatBase sdf = new SimpleDateFormat("dd-MMM-yyyy");
                    return(sdf.Format(DateCellValue, CultureInfo.CurrentCulture));
                }
                return(NumericCellValue + "");

            case CellType.STRING:
                return(RichStringCellValue.ToString());

            default:
                return("Unknown Cell Type: " + CellType);
            }
        }