Ejemplo n.º 1
0
        private void mapCellOnNode(XSSFCell cell, XElement node, ST_XmlDataType outputDataType)
        {
            String value = "";

            switch (cell.CellType)
            {
            case CellType.String: value = cell.StringCellValue; break;

            case CellType.Boolean: value += cell.BooleanCellValue; break;

            case CellType.Error: value = cell.ErrorCellString; break;

            case CellType.Formula: value = cell.StringCellValue; break;

            case CellType.Numeric: value += cell.GetRawValue(); break;

            default:
                break;
            }
            if (node is XElement)
            {
                XElement currentElement = (XElement)node;
                currentElement.Value = value;
            }
            else
            {
                node.Value = value;
            }
        }
Ejemplo n.º 2
0
        private void HandleNonStringCell(StringBuilder text, ICell cell, DataFormatter formatter)
        {
            CellType type = cell.CellType;

            if (type == CellType.Formula)
            {
                type = cell.CachedFormulaResultType;
            }

            if (type == CellType.Numeric)
            {
                ICellStyle cs = cell.CellStyle;

                if (cs.GetDataFormatString() != null)
                {
                    text.Append(formatter.FormatRawCellContents(
                                    cell.NumericCellValue, cs.DataFormat, cs.GetDataFormatString()
                                    ));
                    return;
                }
            }

            // No supported styling applies to this cell
            XSSFCell xcell = (XSSFCell)cell;

            text.Append(xcell.GetRawValue());
        }
Ejemplo n.º 3
0
        private void mapCellOnNode(XSSFCell cell, XmlNode node, ST_XmlDataType outputDataType)
        {
            string str = "";

            switch (cell.CellType)
            {
            case CellType.NUMERIC:
                str += cell.GetRawValue();
                break;

            case CellType.STRING:
                str = cell.StringCellValue;
                break;

            case CellType.FORMULA:
                str = cell.StringCellValue;
                break;

            case CellType.BOOLEAN:
                str += (string)(object)cell.BooleanCellValue;
                break;

            case CellType.ERROR:
                str = cell.ErrorCellString;
                break;
            }
            if (node is XmlElement)
            {
                node.InnerText = str;
            }
            else
            {
                node.Value = str;
            }
        }
Ejemplo n.º 4
0
        private void mapCellOnNode(XSSFCell cell, XmlNode node, ST_XmlDataType outputDataType)
        {
            String value = "";

            switch (cell.CellType)
            {
            case CellType.STRING: value = cell.StringCellValue; break;

            case CellType.BOOLEAN: value += cell.BooleanCellValue; break;

            case CellType.ERROR: value = cell.ErrorCellString; break;

            case CellType.FORMULA: value = cell.StringCellValue; break;

            case CellType.NUMERIC: value += cell.GetRawValue(); break;

            default:
                break;
            }
            if (node is XmlElement)
            {
                XmlElement currentElement = (XmlElement)node;
                currentElement.InnerText = value;
            }
            else
            {
                node.Value = value;
            }
        }
Ejemplo n.º 5
0
        private void HandleNonStringCell(StringBuilder text, ICell cell, DataFormatter formatter)
        {
            CellType cellType = cell.CellType;

            if (cellType == CellType.FORMULA)
            {
                cellType = cell.CachedFormulaResultType;
            }
            if (cellType == CellType.NUMERIC)
            {
                ICellStyle cellStyle = cell.CellStyle;
                if (cellStyle.GetDataFormatString() != null)
                {
                    text.Append(formatter.FormatRawCellContents(cell.NumericCellValue, (int)cellStyle.DataFormat, cellStyle.GetDataFormatString()));
                    return;
                }
            }
            XSSFCell xssfCell = (XSSFCell)cell;

            text.Append(xssfCell.GetRawValue());
        }