/** * Adds a cell comment to a cell just read in * * @param col1 the column for the comment * @param row1 the row for the comment * @param col2 the row for the comment * @param row2 the row for the comment * @param dvsr the validation settings */ private void addCellValidation(int col1,int row1,int col2,int row2,DataValiditySettingsRecord dvsr) { for (int row = row1; row <= row2; row++) { for (int col = col1; col <= col2; col++) { Cell c = null; if (cells.GetLength(0) > row && cells.GetLength(1) > col) c = cells[row,col]; if (c == null) { MulBlankCell mbc = new MulBlankCell(row, col, 0, formattingRecords, sheet); CellFeatures cf = new CellFeatures(); cf.setValidationSettings(dvsr); mbc.setCellFeatures(cf); addCell(mbc); } else if (c is CellFeaturesAccessor) { // Check to see if the cell already contains a comment CellFeaturesAccessor cv = (CellFeaturesAccessor)c; CellFeatures cf = cv.getCellFeatures(); if (cf == null) { cf = new CellFeatures(); cv.setCellFeatures(cf); } cf.setValidationSettings(dvsr); } else { //logger.warn("Not able to add comment to cell type " + c.GetType().Name + // " at " + CellReferenceHelper.getCellReference(col, row)); } } } }
/** * Adds a cell comment to a cell just read in * * @param col the column for the comment * @param row the row for the comment * @param text the comment text * @param width the width of the comment text box * @param height the height of the comment text box */ private void addCellComment(int col,int row,string text,double width,double height) { Cell c = cells[row,col]; if (c == null) { //logger.warn("Cell at " + CellReferenceHelper.getCellReference(col, row) + // " not present - adding a blank"); MulBlankCell mbc = new MulBlankCell(row, col, 0, formattingRecords, sheet); CellFeatures cf = new CellFeatures(); cf.setReadComment(text, width, height); mbc.setCellFeatures(cf); addCell(mbc); return; } if (c is CellFeaturesAccessor) { CellFeaturesAccessor cv = (CellFeaturesAccessor)c; CellFeatures cf = cv.getCellFeatures(); if (cf == null) { cf = new CellFeatures(); cv.setCellFeatures(cf); } cf.setReadComment(text, width, height); } else { //logger.warn("Not able to add comment to cell type " + c.GetType().Name + // " at " + CellReferenceHelper.getCellReference(col, row)); } }