예제 #1
0
  public static void addTableCellProperties(
      TableRow tableRow,
      TableCell tableCell,
      boolean toppest,
      boolean bottomest,
      boolean leftest,
      boolean rightest,
      StringBuilder style) {
    style.append("width:" + (tableCell.getWidth() / TWIPS_PER_INCH) + "in;");
    style.append("padding-start:" + (tableRow.getGapHalf() / TWIPS_PER_INCH) + "in;");
    style.append("padding-end:" + (tableRow.getGapHalf() / TWIPS_PER_INCH) + "in;");

    BorderCode top =
        tableCell.getBrcTop() != null && tableCell.getBrcTop().getBorderType() != 0
            ? tableCell.getBrcTop()
            : toppest ? tableRow.getTopBorder() : tableRow.getHorizontalBorder();
    BorderCode bottom =
        tableCell.getBrcBottom() != null && tableCell.getBrcBottom().getBorderType() != 0
            ? tableCell.getBrcBottom()
            : bottomest ? tableRow.getBottomBorder() : tableRow.getHorizontalBorder();

    BorderCode left =
        tableCell.getBrcLeft() != null && tableCell.getBrcLeft().getBorderType() != 0
            ? tableCell.getBrcLeft()
            : leftest ? tableRow.getLeftBorder() : tableRow.getVerticalBorder();
    BorderCode right =
        tableCell.getBrcRight() != null && tableCell.getBrcRight().getBorderType() != 0
            ? tableCell.getBrcRight()
            : rightest ? tableRow.getRightBorder() : tableRow.getVerticalBorder();

    addBorder(bottom, "bottom", style);
    addBorder(left, "left", style);
    addBorder(right, "right", style);
    addBorder(top, "top", style);
  }
예제 #2
0
 public static void addTableRowProperties(TableRow tableRow, StringBuilder style) {
   if (tableRow.getRowHeight() > 0) {
     style.append("height:" + (tableRow.getRowHeight() / TWIPS_PER_INCH) + "in;");
   }
   if (!tableRow.cantSplit()) {
     style.append("keep-together:always;");
   }
 }