Package org.zkoss.poi.hssf.usermodel

Examples of org.zkoss.poi.hssf.usermodel.HSSFCell


            }

            // Copy each cell from the source row to
            //  the destination row
            for(Iterator<Cell> cells = row.cellIterator(); cells.hasNext(); ) {
                HSSFCell cell = (HSSFCell)cells.next();
                row.removeCell( cell );
                CellValueRecordInterface cellRecord = new HSSFCellHelper(cell).getCellValueRecord();
                cellRecord.setRow( rowNum + n );
                new HSSFRowHelper(row2Replace).createCellFromRecord( cellRecord );
                _helper.getInternalSheet().addValueRecord( rowNum + n, cellRecord );
            }
            // Now zap all the cells in the source row
            new HSSFRowHelper(row).removeAllCells();

            // Move comments from the source row to the
            //  destination row. Note that comments can
            //  exist for cells which are null
            if(moveComments) {
                // This code would get simpler if NoteRecords could be organised by HSSFRow.
                for(int i=noteRecs.length-1; i>=0; i--) {
                    NoteRecord nr = noteRecs[i];
                    if (nr.getRow() != rowNum) {
                        continue;
                    }
                    HSSFComment comment = getCellComment(rowNum, nr.getColumn());
                    if (comment != null) {
                       comment.setRow(rowNum + n);
                    }
                }
            }
        }
       
        //handle inserted rows
        if (srcRow != null) {
          final int row2 = Math.min(startRow + n - 1, SpreadsheetVersion.EXCEL97.getLastRowIndex());
          for ( int rownum = startRow; rownum <= row2; ++rownum) {
            HSSFRow row = getRow(rownum);
            if (row == null) {
              row = createRow(rownum);
            }
            row.setHeight(srcHeight); //height
            if (srcStyle != null) {
              row.setRowStyle((HSSFCellStyle)BookHelper.copyFromStyleExceptBorder(getBook(), srcStyle));//style
            }
            if (srcCells != null) {
              for (Entry<Integer, Cell> cellEntry : srcCells.entrySet()) {
                final Cell srcCell = cellEntry.getValue();
                final CellStyle cellStyle = srcCell.getCellStyle();
                final int c = cellEntry.getKey().intValue();
                Cell cell = row.getCell(c);
                if (cell == null) {
                  cell = row.createCell(c);
                }
                cell.setCellStyle(BookHelper.copyFromStyleExceptBorder(getBook(), cellStyle));
              }
            }
          }
        }
       
View Full Code Here


            // Copy each cell from the source row to
            //  the destination row
            if (wholeRow) {
              for(Iterator<Cell> cells = row.cellIterator(); cells.hasNext(); ) {
                  HSSFCell cell = (HSSFCell)cells.next();
                  row.removeCell( cell );
                  CellValueRecordInterface cellRecord = new HSSFCellHelper(cell).getCellValueRecord();
                  cellRecord.setRow( rowNum + n );
                  new HSSFRowHelper(row2Replace).createCellFromRecord( cellRecord );
                  _helper.getInternalSheet().addValueRecord( rowNum + n, cellRecord );
              }
              // Now zap all the cells in the source row
              new HSSFRowHelper(row).removeAllCells();
            } else {
              final int startCol = Math.max(row.getFirstCellNum(), lCol);
              final int endCol = Math.min(row.getLastCellNum(), rCol);
              for(int col = startCol; col <= endCol; ++col) {
                  HSSFCell cell = (HSSFCell)row.getCell(col);
                  if (cell == null) {
                    continue;
                  }
                  row.removeCell( cell );
                  CellValueRecordInterface cellRecord = new HSSFCellHelper(cell).getCellValueRecord();
View Full Code Here

            // Copy each cell from the source row to
            //  the destination row
          final int startCol = Math.max(row.getFirstCellNum(), lCol);
          final int endCol = Math.min(row.getLastCellNum(), rCol);
            for(int col = startCol; col <= endCol; ++col) {
                HSSFCell cell = (HSSFCell)row.getCell(col);
                if (cell == null) {
                  continue;
                }
                row.removeCell( cell );
                CellValueRecordInterface cellRecord = new HSSFCellHelper(cell).getCellValueRecord();
View Full Code Here

TOP

Related Classes of org.zkoss.poi.hssf.usermodel.HSSFCell

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.