Package org.uguess.birt.report.engine.spreadsheet.model

Examples of org.uguess.birt.report.engine.spreadsheet.model.Cell


        if (removeEmptyRow) {
            // check blank rows.
            for (int i = 0; i < rowCount; i++) {
                for (int j = 0; j < columnCount; j++) {
                    Cell cell = modelSheet.getCell(i, j, false);

                    if (cell != null && isEffectiveCell(cell)) {
                        nonBlankRow[i] = true;
                        break;
                    }
                }
            }
        }

        double width = 0;

        for (short i = 1; i < columnCount + 1; i++) {
            if (!modelSheet.isColumnEmpty(i - 1)) {

                width = modelSheet.getColumnWidth(i - 1) / (1000 * baseCharWidth);
                width *= XLSRenderOption.ADJUST_FACTOR;//Adjust width
                if (resizeEmptyColumn) {
                    xlsSheet.setColumnWidth((i - 1), (int) (width * 256));
                } else {
                    if (!modelSheet.isColumnEmpty(i - 1)) {
                        xlsSheet.setColumnWidth((i - 1), (int) (width * 256));
                    }
                }
            }

        }

        HSSFCellStyle emptyCellStyle = processor.getEmptyCellStyle();
        HSSFCell emptyCell = null;
        boolean fitPageHeight = false;
        int printAreaColumnStart = -1;
        int printAreaColumnEnd = 0;
        int printAreaRowStart = -1;
        int printAreaRowEnd = 0;
        for (short y = 1; y < rowCount; y++) {
            if (!removeEmptyRow || nonBlankRow[y]) {
                HSSFRow xlsRow = xlsSheet.createRow(y);
                double height = modelSheet.getRowHeight(y) / 1000d;// + 2;
                logger.log(Level.FINER, "row height " + y + ": " + height);

                if (!modelSheet.isRowEmpty((y))) {
                    xlsRow.setHeightInPoints(Math.max((float) (height),2f));
                }

                if (printAreaRowStart == -1) {
                    printAreaRowStart = y;
                }
                printAreaRowEnd = y;
                for (short x = 0; x < columnCount; x++) {
                    if (resizeEmptyColumn || ((!resizeEmptyColumn) && !modelSheet.isColumnEmpty(x))) {
                        emptyCell = xlsRow.createCell(x);
                        emptyCell.setCellStyle(emptyCellStyle);
                        if (printAreaColumnStart == -1) {
                            printAreaColumnStart = x;
                        }
                        printAreaColumnEnd = x;
                        Cell element = modelSheet.getCell(y, x, false);
                        if (element != null) {
                            exportCell(element,
                                    x,
                                    y,
                                    xlsSheet,
View Full Code Here


    return cell;
  }

  public Cell getCell( Cell cell, IStyle style )
  {
    Cell newCell = CellImpl.create( cell );
    newCell.setStyle( style );
    return getCell( newCell );
  }
View Full Code Here

    {
      return cell;
    }
    else
    {
      Cell newCell = CellImpl.create( cell );
      newCell.setMergeBlock( merge );
      return getCell( newCell );
    }
  }
View Full Code Here

      diff = ( !thisValue.equals( value ) );
    }

    if ( diff )
    {
      Cell newCell = CellImpl.create( cell );
      newCell.setValue( value );
      cell = getCell( newCell );
    }
    return cell;
  }
View Full Code Here

            return null;
        }

        // TODO use real or automatic sheet name
        Sheet sheet = SheetImpl.create("x", frame.getStyle()); //$NON-NLS-1$
        Cell defaultCell = sheet.getDefaultCell();

        // compute fragments
        List<Integer> xFrags = new ArrayList<Integer>();
        List<Integer> yFrags = new ArrayList<Integer>();
        computeFragments(xFrags, yFrags, frame);
View Full Code Here

    private void setParentsStyle(Sheet sheet, Cell defaultCell,
            Coordinate coords, IStyle style) {
        int yi = 0;
        int xi = 0;
        Cell cell = null;

        yi = coords.y1;
        while (yi <= coords.y2) {
            xi = coords.x1;
            while (xi <= coords.x2) {
View Full Code Here

        boolean xext = false;
        boolean yext = false;
        boolean done = false;

        Cell defaultCell = sheet.getDefaultCell();

        // get the first unmerged cell
        yi = rc.y1;
        FIRST:
        while (yi <= rc.y2) {
            xi = rc.x1;
            while (xi <= rc.x2) {
                Cell cell = sheet.getCell(yi, xi, false);
                if (cell == defaultCell && !cell.isMerged()) {
                    xext = true;
                    yext = true;
                    done = true;
                    break FIRST;
                }
                xi++;
            }
            yi++;
        }

        rc.x1 = xi;
        rc.y1 = yi;
        rc.x2 = rc.x1;
        rc.y2 = rc.y1;

        while (xext || yext) {
            // check x extends
            if (xext) {
                if (rc.x2 < x2max) {
                    xi = rc.x2 + 1;
                    for (yi = rc.y1; yi <= rc.y2; yi++) {
                        Cell cell = sheet.getCell(yi, xi, false);
                        if (cell != defaultCell || cell.isMerged()) {
                            xext = false;
                            break;
                        }
                    }
                    if (xext) {
                        rc.x2++;
                    }
                } else {
                    xext = false;
                }
            }

            // check y extends
            if (yext) {
                if (rc.y2 < y2max) {
                    yi = rc.y2 + 1;
                    for (xi = rc.x1; xi <= rc.x2; xi++) {
                        Cell cell = sheet.getCell(yi, xi, false);
                        if (cell != defaultCell || cell.isMerged()) {
                            yext = false;
                            break;
                        }
                    }
                    if (yext) {
View Full Code Here

        coords.x2 = -1 + xCuts.indexOf(new Integer(coords.x2));
        coords.y2 = -1 + yCuts.indexOf(new Integer(coords.y2));

        if (fixedColumnWidth > 0) {
            // Move overlaped cell to right side
            Cell cell = sheet.getCell(coords.y1, coords.x1, false);
            while (cell != defaultCell) {
                coords.x1++;
                coords.x2++;
                cell = sheet.getCell(coords.y1, coords.x1, false);
            }
View Full Code Here

                        xOffset,
                        yOffset);

                setParentsStyle(sheet, defaultCell, coord, style);
            } else {
                Cell cell = sheet.getCell(coord.y1, coord.x1, false);
                Object data = element.getData();
                if (coord.x1 == coord.x2 && coord.y1 == coord.y2) {
                    // A single cell case.
                    if (cell != defaultCell) {
                        logger.log(Level.WARNING, "[WARNING]:An existing single cell detected"); //$NON-NLS-1$
View Full Code Here

            }

            style = StyleImpl.createEmpty();
        }

        Cell cell = cellPool.getCell(CellImpl.create(value, formula, style));
        return setCell(row, col, cell, true);
    }
View Full Code Here

TOP

Related Classes of org.uguess.birt.report.engine.spreadsheet.model.Cell

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.