示例#1
0
        /**
         * Handles any addition cell features, such as comments or data
         * validation.  Called internally from this class when a cell is
         * added to the workbook, and also externally from BaseCellFeatures
         * following a call to setComment
         */
        public void addCellFeatures()
        {
            if (features == null)
                {
                return;
                }

            if (copied == true)
                {
                copied = false;

                return;
                }

            if (features.getComment() != null)
                {
                Comment comment = new Comment(features.getComment(),
                                              column, row);
                comment.setWidth(features.getCommentWidth());
                comment.setHeight(features.getCommentHeight());
                sheet.addDrawing(comment);
                sheet.getWorkbook().addDrawing(comment);
                features.setCommentDrawing(comment);
                }

            if (features.hasDataValidation())
                {
                try
                    {
                    features.getDVParser().setCell(column,
                                                   row,
                                                   sheet.getWorkbook(),
                                                   sheet.getWorkbook(),
                                                   sheet.getWorkbookSettings());
                    }
                catch (CSharpJExcel.Jxl.Biff.Formula.FormulaException e)
                    {
                    Assert.verify(false);
                    }

                sheet.addValidationCell(this);
                if (!features.hasDropDown())
                    {
                    return;
                    }

                // Get the combo box drawing object for list validations
                if (sheet.getComboBox() == null)
                    {
                    // Need to add the combo box the first time, since even though
                    // it doesn't need a separate Sp entry, it still needs to increment
                    // the shape id
                    ComboBox cb = new ComboBox();
                    sheet.addDrawing(cb);
                    sheet.getWorkbook().addDrawing(cb);
                    sheet.setComboBox(cb);
                    }

                features.setComboBox(sheet.getComboBox());
                }
        }