Package com.lowagie.text

Examples of com.lowagie.text.Row


                }
                return;
            }
            case Element.ROW:
            {
                Row row = (Row) element;
               
                // start tag
                addTabs(indent);
                writeStart(HtmlTags.ROW);
                writeMarkupAttributes(markup);
                os.write(GT);
                // contents
                Element cell;
                for (int i = 0; i < row.getColumns(); i++) {
                    if ((cell = (Element)row.getCell(i)) != null) {
                        write(cell, indent + 1);
                    }
                }
                // end tag
                addTabs(indent);
                writeEnd(HtmlTags.ROW);
                return;
            }
            case Element.TABLE:
            {
              Table table;
              try {
                table = (Table) element;
              }
              catch(ClassCastException cce) {
                try {
            table = ((SimpleTable)element).createTable();
          } catch (BadElementException e) {
            throw new ExceptionConverter(e);
          }
              }
                table.complete();
                // start tag
                addTabs(indent);
                writeStart(HtmlTags.TABLE);
                writeMarkupAttributes(markup);
                os.write(SPACE);
                write(HtmlTags.WIDTH);
                os.write(EQUALS);
                os.write(QUOTE);
                write(String.valueOf(table.getWidth()));
                if (!table.isLocked()){
                    write("%");
                }
                os.write(QUOTE);
                String alignment = HtmlEncoder.getAlignment(table.getAlignment());
                if (!"".equals(alignment)) {
                    write(HtmlTags.ALIGN, alignment);
                }
                write(HtmlTags.CELLPADDING, String.valueOf(table.getPadding()));
                write(HtmlTags.CELLSPACING, String.valueOf(table.getSpacing()));
                if (table.getBorderWidth() != Rectangle.UNDEFINED) {
                    write(HtmlTags.BORDERWIDTH, String.valueOf(table.getBorderWidth()));
                }
                if (table.getBorderColor() != null) {
                    write(HtmlTags.BORDERCOLOR, HtmlEncoder.encode(table.getBorderColor()));
                }
                if (table.getBackgroundColor() != null) {
                    write(HtmlTags.BACKGROUNDCOLOR, HtmlEncoder.encode(table.getBackgroundColor()));
                }
                os.write(GT);
                // contents
                Row row;
                for (Iterator iterator = table.iterator(); iterator.hasNext(); ) {
                    row = (Row) iterator.next();
                    write(row, indent + 1);
                }
                // end tag
View Full Code Here


      // postprocess on table: to remove at next release...

      Iterator iRow = table.iterator();
      while (iRow.hasNext()) {
    Row r = (Row)iRow.next();
    Cell c = (Cell)r.getCell(1);
    if (c.isEmpty()) iRow.remove();
      }

      // deny row split
      table.setCellsFitPage(true);
View Full Code Here

   * Updates the table row additions in the underlying table object
   */
 
  private void updateRowAdditionsInternal() {
    // correct table : fill empty cells/ parse table in table
    Row row;
    int prevRows = rows();
    int rowNumber = 0;
    int groupNumber = 0;
    boolean groupChange;
    int firstDataRow = table.getLastHeaderRow() + 1;
    Cell cell;
    PdfCell currentCell;
    ArrayList newCells = new ArrayList();
    int rows = table.size() + 1;
    float[] offsets = new float[rows];
    for (int i = 0; i < rows; i++) {
      offsets[i] = getBottom();
    }
       
    // loop over all the rows
    for (Iterator rowIterator = table.iterator(); rowIterator.hasNext(); ) {
      groupChange = false;
      row = (Row) rowIterator.next();
      if (row.isEmpty()) {
        if (rowNumber < rows - 1 && offsets[rowNumber + 1] > offsets[rowNumber]) offsets[rowNumber + 1] = offsets[rowNumber];
      }
      else {
        for(int i = 0; i < row.getColumns(); i++) {
          cell = (Cell) row.getCell(i);
          if (cell != null) {
            currentCell = new PdfCell(cell, rowNumber+prevRows, positions[i], positions[i + cell.getColspan()], offsets[rowNumber], cellspacing(), cellpadding());
            if (rowNumber < firstDataRow) {
              currentCell.setHeader();
              headercells.add(currentCell);
View Full Code Here

     */
    public boolean importTable(Table table, int pageWidth) {
        origTable = table;
        // All Cells are pregenerated first, so that cell and rowspanning work
        Iterator rows = table.iterator();
        Row row = null;

        int tableWidth = (int) table.getWidth();
        int cellpadding = (int) (table.getPadding() * RtfWriter.TWIPSFACTOR);
        int cellspacing = (int) (table.getSpacing() * RtfWriter.TWIPSFACTOR);
        float[] propWidths = table.getProportionalWidths();

        int borders = table.getBorder();
        com.google.code.appengine.awt.Color borderColor = table.getBorderColor();
        float borderWidth = table.getBorderWidth();

        for (int i = 0; i < table.size(); i++) {
            RtfRow rtfRow = new RtfRow(writer, this);
            rtfRow.pregenerateRows(table.getColumns());
            rowsList.add(rtfRow);
        }
        int i = 0;
        while (rows.hasNext()) {
            row = (Row) rows.next();
            row.setHorizontalAlignment(table.getAlignment());
            RtfRow rtfRow = (RtfRow) rowsList.get(i);
            rtfRow.importRow(row, propWidths, tableWidth, pageWidth, cellpadding, cellspacing, borders, borderColor, borderWidth, i);
            i++;
        }
        return true;
View Full Code Here

                }
                return;
            }
            case Element.ROW:
            {
                Row row = (Row) element;
               
                // start tag
                addTabs(indent);
                writeStart(HtmlTags.ROW);
                writeMarkupAttributes(markup);
                os.write(GT);
                // contents
                Element cell;
                for (int i = 0; i < row.getColumns(); i++) {
                    if ((cell = (Element)row.getCell(i)) != null) {
                        write(cell, indent + 1);
                    }
                }
                // end tag
                addTabs(indent);
                writeEnd(HtmlTags.ROW);
                return;
            }
            case Element.TABLE:
            {
              Table table;
              try {
                table = (Table) element;
              }
              catch(ClassCastException cce) {
                try {
            table = ((SimpleTable)element).createTable();
          } catch (BadElementException e) {
            throw new ExceptionConverter(e);
          }
              }
                table.complete();
                // start tag
                addTabs(indent);
                writeStart(HtmlTags.TABLE);
                writeMarkupAttributes(markup);
                os.write(SPACE);
                write(HtmlTags.WIDTH);
                os.write(EQUALS);
                os.write(QUOTE);
                write(String.valueOf(table.getWidth()));
                if (!table.isLocked()){
                    write("%");
                }
                os.write(QUOTE);
                String alignment = HtmlEncoder.getAlignment(table.getAlignment());
                if (!"".equals(alignment)) {
                    write(HtmlTags.ALIGN, alignment);
                }
                write(HtmlTags.CELLPADDING, String.valueOf(table.getPadding()));
                write(HtmlTags.CELLSPACING, String.valueOf(table.getSpacing()));
                if (table.getBorderWidth() != Rectangle.UNDEFINED) {
                    write(HtmlTags.BORDERWIDTH, String.valueOf(table.getBorderWidth()));
                }
                if (table.getBorderColor() != null) {
                    write(HtmlTags.BORDERCOLOR, HtmlEncoder.encode(table.getBorderColor()));
                }
                if (table.getBackgroundColor() != null) {
                    write(HtmlTags.BACKGROUNDCOLOR, HtmlEncoder.encode(table.getBackgroundColor()));
                }
                os.write(GT);
                // contents
                Row row;
                for (Iterator iterator = table.iterator(); iterator.hasNext(); ) {
                    row = (Row) iterator.next();
                    write(row, indent + 1);
                }
                // end tag
View Full Code Here

   * Updates the table row additions in the underlying table object
   */
 
  private void updateRowAdditionsInternal() {
    // correct table : fill empty cells/ parse table in table
    Row row;
    int prevRows = rows();
    int rowNumber = 0;
    int groupNumber = 0;
    boolean groupChange;
    int firstDataRow = table.getLastHeaderRow() + 1;
    Cell cell;
    PdfCell currentCell;
    ArrayList newCells = new ArrayList();
    int rows = table.size() + 1;
    float[] offsets = new float[rows];
    for (int i = 0; i < rows; i++) {
      offsets[i] = getBottom();
    }
       
    // loop over all the rows
    for (Iterator rowIterator = table.iterator(); rowIterator.hasNext(); ) {
      groupChange = false;
      row = (Row) rowIterator.next();
      if (row.isEmpty()) {
        if (rowNumber < rows - 1 && offsets[rowNumber + 1] > offsets[rowNumber]) offsets[rowNumber + 1] = offsets[rowNumber];
      }
      else {
        for(int i = 0; i < row.getColumns(); i++) {
          cell = (Cell) row.getCell(i);
          if (cell != null) {
            currentCell = new PdfCell(cell, rowNumber+prevRows, positions[i], positions[i + cell.getColspan()], offsets[rowNumber], cellspacing(), cellpadding());
            try {
                     if (offsets[rowNumber] - currentCell.getHeight() - cellpadding() < offsets[rowNumber + currentCell.rowspan()]) {
                        offsets[rowNumber + currentCell.rowspan()] = offsets[rowNumber] - currentCell.getHeight() - cellpadding();
View Full Code Here

                }
                return;
            }
            case Element.ROW:
            {
                Row row = (Row) element;
               
                // start tag
                addTabs(indent);
                writeStart(HtmlTags.ROW);
                writeMarkupAttributes(markup);
                os.write(GT);
                // contents
                Element cell;
                for (int i = 0; i < row.getColumns(); i++) {
                    if ((cell = (Element)row.getCell(i)) != null) {
                        write(cell, indent + 1);
                    }
                }
                // end tag
                addTabs(indent);
                writeEnd(HtmlTags.ROW);
                return;
            }
            case Element.TABLE:
            {
              Table table;
              try {
                table = (Table) element;
              }
              catch(ClassCastException cce) {
                try {
            table = ((SimpleTable)element).createTable();
          } catch (BadElementException e) {
            throw new ExceptionConverter(e);
          }
              }
                table.complete();
                // start tag
                addTabs(indent);
                writeStart(HtmlTags.TABLE);
                writeMarkupAttributes(markup);
                os.write(SPACE);
                write(HtmlTags.WIDTH);
                os.write(EQUALS);
                os.write(QUOTE);
                write(String.valueOf(table.getWidth()));
                if (!table.isLocked()){
                    write("%");
                }
                os.write(QUOTE);
                String alignment = HtmlEncoder.getAlignment(table.getAlignment());
                if (!"".equals(alignment)) {
                    write(HtmlTags.ALIGN, alignment);
                }
                write(HtmlTags.CELLPADDING, String.valueOf(table.getPadding()));
                write(HtmlTags.CELLSPACING, String.valueOf(table.getSpacing()));
                if (table.getBorderWidth() != Rectangle.UNDEFINED) {
                    write(HtmlTags.BORDERWIDTH, String.valueOf(table.getBorderWidth()));
                }
                if (table.getBorderColor() != null) {
                    write(HtmlTags.BORDERCOLOR, HtmlEncoder.encode(table.getBorderColor()));
                }
                if (table.getBackgroundColor() != null) {
                    write(HtmlTags.BACKGROUNDCOLOR, HtmlEncoder.encode(table.getBackgroundColor()));
                }
                os.write(GT);
                // contents
                Row row;
                for (Iterator iterator = table.iterator(); iterator.hasNext(); ) {
                    row = (Row) iterator.next();
                    write(row, indent + 1);
                }
                // end tag
View Full Code Here

TOP

Related Classes of com.lowagie.text.Row

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.