当前位置: 首页>>代码示例>>Java>>正文


Java PdfPCell.setBorderWidthTop方法代码示例

本文整理汇总了Java中com.itextpdf.text.pdf.PdfPCell.setBorderWidthTop方法的典型用法代码示例。如果您正苦于以下问题:Java PdfPCell.setBorderWidthTop方法的具体用法?Java PdfPCell.setBorderWidthTop怎么用?Java PdfPCell.setBorderWidthTop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.itextpdf.text.pdf.PdfPCell的用法示例。


在下文中一共展示了PdfPCell.setBorderWidthTop方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addTotalRow

import com.itextpdf.text.pdf.PdfPCell; //导入方法依赖的package包/类
/**
 * Adds a total row to the table.
 *
 * @param table
 *         the table.
 * @param contents
 *         the columns contents.
 * @param font
 *         the font to use.
 * @param borderTop
 *         the border top width.
 * @param borderBottom
 *         the border bottom width.
 */
private static void addTotalRow(PdfPTable table, Object[] contents, Font font, float borderTop,
                                float borderBottom) {
    PdfPCell labelCell = ReportServiceHelper.createTableCell(contents[0], font, null,
            ReportServiceHelper.PDF_ALIGN_RIGHT, null, 2);
    labelCell.setBorderWidth(0);
    labelCell.setBorderWidthTop(borderTop);
    labelCell.setBorderWidthBottom(borderBottom);
    table.addCell(labelCell);

    PdfPCell numberCell = ReportServiceHelper.createTableCell(contents[1], font, null,
            ReportServiceHelper.PDF_ALIGN_RIGHT, null, 1);
    numberCell.setBorderWidth(0);
    numberCell.setBorderWidthTop(borderTop);
    numberCell.setBorderWidthBottom(borderBottom);
    table.addCell(numberCell);

    PdfPCell totalCell = ReportServiceHelper.createTableCell(contents.length == 3 ? contents[2] : null, font, null,
            ReportServiceHelper.PDF_ALIGN_RIGHT, null, 1);
    totalCell.setBorderWidth(0);
    totalCell.setBorderWidthTop(borderTop);
    totalCell.setBorderWidthBottom(borderBottom);
    table.addCell(totalCell);

    PdfPCell emptyCell = ReportServiceHelper.createEmptyPdfCell(1, null);
    emptyCell.setBorderWidth(0);
    emptyCell.setBorderWidthTop(borderTop);
    emptyCell.setBorderWidthBottom(borderBottom);
    table.addCell(emptyCell);
}
 
开发者ID:NASA-Tournament-Lab,项目名称:CoECI-OPM-Service-Credit-Redeposit-Deposit-Application,代码行数:44,代码来源:BalancedScorecardPaymentReportService.java

示例2: onEndPage

import com.itextpdf.text.pdf.PdfPCell; //导入方法依赖的package包/类
@Override
// initialization of the header table
public void onEndPage(final PdfWriter writer,
                      final Document document) {
  final PdfPTable header = new PdfPTable(2);
  final Phrase p = new Phrase();
  final Chunk ck = new Chunk(String.format("%s%n %s Finalist Schedule - Award Group: %s", //
                                           mChallengeTitle, //
                                           mShowPrivate ? "Private" : "", mDivision), HEADER_FONT);
  p.add(ck);
  header.getDefaultCell().setBorderWidth(0);
  header.addCell(p);
  header.getDefaultCell().setHorizontalAlignment(com.itextpdf.text.Element.ALIGN_RIGHT);
  header.addCell(new Phrase(new Chunk(String.format("Tournament: %s %nDate: %s", mTournament, mFormattedDate),
                                      HEADER_FONT)));
  final PdfPCell blankCell = new PdfPCell();
  blankCell.setBorder(0);
  blankCell.setBorderWidthTop(1.0f);
  blankCell.setColspan(2);
  header.addCell(blankCell);

  final PdfContentByte cb = writer.getDirectContent();
  cb.saveState();
  header.setTotalWidth(document.right()
      - document.left());
  header.writeSelectedRows(0, -1, document.left(), document.getPageSize().getHeight() - 10, cb);
  cb.restoreState();
}
 
开发者ID:jpschewe,项目名称:fll-sw,代码行数:29,代码来源:AbstractFinalistSchedule.java

示例3: onEndPage

import com.itextpdf.text.pdf.PdfPCell; //导入方法依赖的package包/类
@Override
// initialization of the header table
public void onEndPage(final PdfWriter writer,
                      final Document document) {
  final PdfPTable header = new PdfPTable(2);
  final Phrase p = new Phrase();
  final Chunk ck = new Chunk(_challengeTitle
      + "\n" + _reportTitle, _font);
  p.add(ck);
  header.getDefaultCell().setBorderWidth(0);
  header.addCell(p);
  header.getDefaultCell().setHorizontalAlignment(com.itextpdf.text.Element.ALIGN_RIGHT);
  header.addCell(new Phrase(new Chunk("Tournament: "
      + _tournament + "\nDate: " + _formattedDate, _font)));
  final PdfPCell blankCell = new PdfPCell();
  blankCell.setBorder(0);
  blankCell.setBorderWidthTop(1.0f);
  blankCell.setColspan(2);
  header.addCell(blankCell);

  final PdfContentByte cb = writer.getDirectContent();
  cb.saveState();
  header.setTotalWidth(document.right()
      - document.left());
  header.writeSelectedRows(0, -1, document.left(), document.getPageSize().getHeight() - 10, cb);
  cb.restoreState();
}
 
开发者ID:jpschewe,项目名称:fll-sw,代码行数:28,代码来源:ReportPageEventHandler.java

示例4: onEndPage

import com.itextpdf.text.pdf.PdfPCell; //导入方法依赖的package包/类
@Override
// initialization of the header table
public void onEndPage(final PdfWriter writer,
                      final Document document) {
  final PdfPTable header = new PdfPTable(2);
  final Phrase p = new Phrase();
  final Chunk ck = new Chunk(_challengeTitle
      + "\n"
      + _reportTitle, _font);
  p.add(ck);
  header.getDefaultCell().setBorderWidth(0);
  header.addCell(p);
  header.getDefaultCell().setHorizontalAlignment(com.itextpdf.text.Element.ALIGN_RIGHT);
  header.addCell(new Phrase(new Chunk("Tournament: "
      + _tournament
      + "\nDate: "
      + _formattedDate, _font)));

  // horizontal line
  final PdfPCell blankCell = new PdfPCell();
  blankCell.setBorder(0);
  blankCell.setBorderWidthTop(1.0f);
  blankCell.setColspan(2);
  header.addCell(blankCell);

  if (null != _team) {
    // team information
    final Paragraph para = new Paragraph();
    para.add(new Chunk("Team #"
        + _team.getTeamNumber()
        + " "
        + _team.getTeamName()
        + " / "
        + _team.getOrganization(), TITLE_FONT));
    para.add(Chunk.NEWLINE);
    para.add(new Chunk("Award Group: "
        + _team.getAwardGroup(), TITLE_FONT));
    para.add(Chunk.NEWLINE);

    final PdfPCell teamInformation = new PdfPCell(para);
    teamInformation.setBorder(0);
    teamInformation.setColspan(2);

    header.addCell(teamInformation);
  }

  header.setTotalWidth(document.right()
      - document.left());

  final PdfContentByte cb = writer.getDirectContent();
  cb.saveState();
  header.writeSelectedRows(0, -1, document.left(), document.getPageSize().getHeight()
      - 10, cb);
  cb.restoreState();
}
 
开发者ID:jpschewe,项目名称:fll-sw,代码行数:56,代码来源:PerformanceScoreReport.java

示例5: outputSubjectiveScheduleByTime

import com.itextpdf.text.pdf.PdfPCell; //导入方法依赖的package包/类
private void outputSubjectiveScheduleByTime(final Document detailedSchedules,
                                            final String subjectiveStation)
    throws DocumentException {
  final PdfPTable table = PdfUtils.createTable(6);
  int currentRow = 0;
  table.setWidths(new float[] { 2, 1, 3, 3, 2, 2 });

  final PdfPCell tournamentCell = PdfUtils.createHeaderCell("Tournament: "
      + getName()
      + " - "
      + subjectiveStation);
  tournamentCell.setColspan(6);
  table.addCell(tournamentCell);
  table.completeRow();
  currentRow++;

  table.addCell(PdfUtils.createHeaderCell(TEAM_NUMBER_HEADER));
  table.addCell(PdfUtils.createHeaderCell(AWARD_GROUP_HEADER));
  table.addCell(PdfUtils.createHeaderCell(ORGANIZATION_HEADER));
  table.addCell(PdfUtils.createHeaderCell(TEAM_NAME_HEADER));
  table.addCell(PdfUtils.createHeaderCell(subjectiveStation));
  table.addCell(PdfUtils.createHeaderCell(JUDGE_GROUP_HEADER));
  table.completeRow();
  currentRow++;
  table.setHeaderRows(2);

  Collections.sort(_schedule, getComparatorForSubjectiveByTime(subjectiveStation));
  LocalTime prevTime = null;
  for (final TeamScheduleInfo si : _schedule) {
    final LocalTime time = si.getSubjectiveTimeByName(subjectiveStation).getTime();

    final float topBorderWidth;
    if (Objects.equals(time, prevTime)) {
      topBorderWidth = Rectangle.UNDEFINED;

      // keep the rows with the same times together
      table.getRow(currentRow
          - 1).setMayNotBreak(true);
    } else {
      topBorderWidth = TIME_SEPARATOR_LINE_WIDTH;
    }

    PdfPCell cell = PdfUtils.createCell(String.valueOf(si.getTeamNumber()));
    cell.setBorderWidthTop(topBorderWidth);
    table.addCell(cell);

    cell = PdfUtils.createCell(si.getAwardGroup());
    cell.setBorderWidthTop(topBorderWidth);
    table.addCell(cell);

    cell = PdfUtils.createCell(si.getOrganization());
    cell.setBorderWidthTop(topBorderWidth);
    table.addCell(cell);

    cell = PdfUtils.createCell(si.getTeamName());
    cell.setBorderWidthTop(topBorderWidth);
    table.addCell(cell);

    cell = PdfUtils.createCell(formatTime(time));
    cell.setBorderWidthTop(topBorderWidth);
    table.addCell(cell);

    cell = PdfUtils.createCell(si.getJudgingGroup());
    cell.setBorderWidthTop(topBorderWidth);
    table.addCell(cell);
    table.completeRow();

    currentRow++;
    prevTime = time;
  }

  // make sure the last row isn't by itself
  table.getRow(currentRow
      - 1).setMayNotBreak(true);

  detailedSchedules.add(table);

}
 
开发者ID:jpschewe,项目名称:fll-sw,代码行数:79,代码来源:TournamentSchedule.java


注:本文中的com.itextpdf.text.pdf.PdfPCell.setBorderWidthTop方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。