Пример #1
0
        /**
         * Performs a shallow copy of the specified cell
         */
        private WritableCell shallowCopyCell(Cell cell)
        {
            CellType     ct      = cell.getType();
            WritableCell newCell = null;

            if (ct == CellType.LABEL)
            {
                newCell = new Label((LabelCell)cell);
            }
            else if (ct == CellType.NUMBER)
            {
                newCell = new Number((NumberCell)cell);
            }
            else if (ct == CellType.DATE)
            {
                newCell = new ExcelDateTime((DateCell)cell);
            }
            else if (ct == CellType.BOOLEAN)
            {
                newCell = new Boolean((BooleanCell)cell);
            }
            else if (ct == CellType.NUMBER_FORMULA)
            {
                newCell = new ReadNumberFormulaRecord((FormulaData)cell);
            }
            else if (ct == CellType.STRING_FORMULA)
            {
                newCell = new ReadStringFormulaRecord((FormulaData)cell);
            }
            else if (ct == CellType.BOOLEAN_FORMULA)
            {
                newCell = new ReadBooleanFormulaRecord((FormulaData)cell);
            }
            else if (ct == CellType.DATE_FORMULA)
            {
                newCell = new ReadDateFormulaRecord((FormulaData)cell);
            }
            else if (ct == CellType.FORMULA_ERROR)
            {
                newCell = new ReadErrorFormulaRecord((FormulaData)cell);
            }
            else if (ct == CellType.EMPTY)
            {
                if (cell.getCellFormat() != null)
                {
                    // It is a blank cell, rather than an empty cell, so
                    // it may have formatting information, so
                    // it must be copied
                    newCell = new Blank(cell);
                }
            }

            return(newCell);
        }
Пример #2
0
        /**
         * Performs a shallow copy of the specified cell
         */
        private WritableCell shallowCopyCell(Cell cell)
        {
            CellType ct = cell.getType();
            WritableCell newCell = null;

            if (ct == CellType.LABEL)
                {
                newCell = new Label((LabelCell)cell);
                }
            else if (ct == CellType.NUMBER)
                {
                newCell = new Number((NumberCell)cell);
                }
            else if (ct == CellType.DATE)
                {
                newCell = new ExcelDateTime((DateCell)cell);
                }
            else if (ct == CellType.BOOLEAN)
                {
                newCell = new Boolean((BooleanCell)cell);
                }
            else if (ct == CellType.NUMBER_FORMULA)
                {
                newCell = new ReadNumberFormulaRecord((FormulaData)cell);
                }
            else if (ct == CellType.STRING_FORMULA)
                {
                newCell = new ReadStringFormulaRecord((FormulaData)cell);
                }
            else if (ct == CellType.BOOLEAN_FORMULA)
                {
                newCell = new ReadBooleanFormulaRecord((FormulaData)cell);
                }
            else if (ct == CellType.DATE_FORMULA)
                {
                newCell = new ReadDateFormulaRecord((FormulaData)cell);
                }
            else if (ct == CellType.FORMULA_ERROR)
                {
                newCell = new ReadErrorFormulaRecord((FormulaData)cell);
                }
            else if (ct == CellType.EMPTY)
                {
                if (cell.getCellFormat() != null)
                    {
                    // It is a blank cell, rather than an empty cell, so
                    // it may have formatting information, so
                    // it must be copied
                    newCell = new Blank(cell);
                    }
                }

            return newCell;
        }