com.itextpdf.text.Phrase.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(199)

本文整理了Java中com.itextpdf.text.Phrase.<init>()方法的一些代码示例,展示了Phrase.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Phrase.<init>()方法的具体详情如下:
包路径:com.itextpdf.text.Phrase
类名称:Phrase
方法名:<init>

Phrase.<init>介绍

[英]Constructs a Phrase without specifying a leading.
[中]在不指定前导的情况下构造Phrase

代码示例

代码示例来源:origin: com.itextpdf/itextpdf

/**
 * Adds a <CODE>Chunk</CODE> to the current text array. Will not have any
 * effect if addElement() was called before.
 *
 * @param chunk the text
 */
public void addText(final Chunk chunk) {
  if (chunk == null || composite) {
    return;
  }
  addText(new Phrase(chunk));
}

代码示例来源:origin: com.itextpdf/itextg

/**
 * Adds a cell element.
 *
 * @param text the text for the cell
 */
public void addCell(final String text) {
  addCell(new Phrase(text));
}

代码示例来源:origin: com.itextpdf/itextpdf

/**
 * Adds a cell element.
 *
 * @param text the text for the cell
 */
public void addCell(final String text) {
  addCell(new Phrase(text));
}

代码示例来源:origin: com.itextpdf/itextg

/**
 * Adds a <CODE>Chunk</CODE> to the current text array. Will not have any
 * effect if addElement() was called before.
 *
 * @param chunk the text
 */
public void addText(final Chunk chunk) {
  if (chunk == null || composite) {
    return;
  }
  addText(new Phrase(chunk));
}

代码示例来源:origin: hmkcode/Java

private static PdfPCell createValueCell(String text){
    // font
    Font font = new Font(FontFamily.HELVETICA, 8, Font.NORMAL, BaseColor.BLACK);
    
    // create cell
    PdfPCell cell = new PdfPCell(new Phrase(text,font));
    
    // set style
    Style.valueCellStyle(cell);
    return cell;
  }
}

代码示例来源:origin: hmkcode/Java

private static PdfPCell createLabelCell(String text){
  // font
  Font font = new Font(FontFamily.HELVETICA, 8, Font.BOLD, BaseColor.DARK_GRAY);
  
  // create cell
  PdfPCell cell = new PdfPCell(new Phrase(text,font));
  // set style
  Style.labelCellStyle(cell);
  return cell;
}

代码示例来源:origin: org.technbolts.tzatziki/tzatziki-pdf

private void emitHeader(PdfPTable table, ITextContext emitterContext) {
  Styles styles = emitterContext.styles();
  CellStyler styler = headerCellStyler;
  if (styler == null)
    styler = new DefaultHeaderCellStyler(styles);
  table.addCell(styler.applyStyle(new PdfPCell(new Phrase("Tag/Description", styler.cellFont()))));
  table.addCell(styler.applyStyle(new PdfPCell(new Phrase("Passed", styler.cellFont()))));
  table.addCell(styler.applyStyle(new PdfPCell(new Phrase("Failed", styler.cellFont()))));
  table.addCell(styler.applyStyle(new PdfPCell(new Phrase("Other", styler.cellFont()))));
}

代码示例来源:origin: cn.afterturn/easypoi-base

private PdfPCell createStringCell(PdfPTable table, String text, ExcelExportEntity entity,
                 int rowHeight) {
  PdfPCell iCell = new PdfPCell(new Phrase(text, styler.getFont(entity, text)));
  styler.setCellStyler(iCell, entity, text);
  iCell.setFixedHeight((int) (rowHeight * 2.5));
  table.addCell(iCell);
  return iCell;
}

代码示例来源:origin: org.technbolts.tzatziki/tzatziki-pdf

@Override
  public void consume(Element element) {
    PdfPCell cell = new PdfPCell();
    cell.addElement(element);
    steps.addCell(noBorder(colspan(2, new PdfPCell(new Phrase("")))));
    steps.addCell(noBorder(cell));
  }
};

代码示例来源:origin: org.jeecg/easypoi-base

private PdfPCell createStringCell(PdfPTable table, String text, ExcelExportEntity entity,
                 int rowHeight) {
  PdfPCell iCell = new PdfPCell(new Phrase(text, styler.getFont(entity, text)));
  styler.setCellStyler(iCell, entity, text);
  iCell.setFixedHeight((int) (rowHeight * 2.5));
  table.addCell(iCell);
  return iCell;
}

代码示例来源:origin: com.jslsolucoes/tagria-lib

private void title(PdfPTable pdf) {
  PdfPCell cell = new PdfPCell(new Phrase(table.getTitle(), smallBold));
  cell.setHorizontalAlignment(Element.ALIGN_CENTER);
  cell.setColspan(table.getHeaders().size());
  pdf.addCell(cell);
}

代码示例来源:origin: com.jslsolucoes/tagria-lib

private void header(PdfPTable pdf) {
  for (Header header : table.getHeaders()) {
    PdfPCell cell = new PdfPCell(new Phrase(header.getContent(), smallBold));
    if ("center".equals(header.getAlign()))
      cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    else if ("left".equals(header.getAlign()))
      cell.setHorizontalAlignment(Element.ALIGN_LEFT);
    else if ("right".equals(header.getAlign()))
      cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
    pdf.addCell(cell);
  }
}

代码示例来源:origin: com.jslsolucoes/tagria-lib

private void body(PdfPTable pdf) {
  for (Row row : table.getRows()) {
    for (Column column : row.getColumns()) {
      PdfPCell cell = new PdfPCell(new Phrase(column.getContent(), smallBold));
      if ("center".equals(column.getAlign()))
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
      else if ("left".equals(column.getAlign()))
        cell.setHorizontalAlignment(Element.ALIGN_LEFT);
      else if ("right".equals(column.getAlign()))
        cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
      pdf.addCell(cell);
    }
  }
}

代码示例来源:origin: org.technbolts.tzatziki/tzatziki-pdf

private void emitHeaders(PdfPTable table, CellStyler styler) {
    Phrase tagHeader = new Phrase("Tag", styler.cellFont());
    Phrase descHeader = new Phrase("Description", styler.cellFont());
    table.addCell(styler.applyStyle(new PdfPCell(tagHeader)));
    table.addCell(styler.applyStyle(new PdfPCell(descHeader)));
    table.setHeaderRows(1);
  }
}

代码示例来源:origin: org.technbolts.tzatziki/tzatziki-pdf

private PdfPCell statusCell(Status status, Styles styles) {
    Phrase statusSymbol = new Phrase(statusMarker.statusMarker(status));
    PdfPCell statusCell = new PdfPCell(statusSymbol);
    statusCell.setVerticalAlignment(Element.ALIGN_TOP);
    statusCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
    if (!debugTable)
      statusCell.setBorder(Rectangle.NO_BORDER);
    return statusCell;
  }
}

代码示例来源:origin: org.technbolts.tzatziki/tzatziki-pdf

private PdfPCell statusCell(Status status) {
  Phrase statusSymbol = new Phrase(statusMarker.statusMarker(status));
  PdfPCell statusCell = new PdfPCell(statusSymbol);
  statusCell.setVerticalAlignment(Element.ALIGN_TOP);
  statusCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
  statusCell = noBorder(statusCell);
  return statusCell;
}

代码示例来源:origin: org.technbolts.tzatziki/tzatziki-pdf

private PdfPCell valuedCell(int value, int total, CellStyler styler, Function<Float, BaseColor> colorProviders) {
  Phrase phrase = new Phrase(value + "/" + total, styler.cellFont());
  PdfPCell cell = styler.applyStyle(new PdfPCell(phrase));
  cell.setCellEvent(
      new PercentBackgroundEvent(
          value,
          total,
          colorProviders));
  return cell;
}

代码示例来源:origin: com.github.hazendaz/displaytag

@Override
public void onEndPage(PdfWriter writer, Document document)
{
  ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_CENTER, new Phrase(
    TagConstants.EMPTY_STRING,
    PdfView.this.smallFont), (document.left() + document.right()) / 2, document.bottom() - 18, 0);
}

代码示例来源:origin: Swati4star/Images-to-PDF

public void setWatermark(Watermark watermark) {
    this.mWatermark = watermark;
    this.mPhrase = new Phrase(mWatermark.getWatermarkText(),
        new Font(mWatermark.getFontFamily(), mWatermark.getTextSize(),
            mWatermark.getFontStyle(), mWatermark.getTextColor()));
  }
}

代码示例来源:origin: org.technbolts.tzatziki/tzatziki-pdf

private void emitStepInErrorLegend(ITextContext emitterContext) {
  Styles styles = emitterContext.styles();
  PdfPTable table = new PdfPTable(new float[]{1f, 24f});
  table.addCell(noBorder(topRight(new PdfPCell(stepInErrorMarker(styles)))));
  table.addCell(noBorder(new PdfPCell(new Phrase(": First step in error within the scenario",
      new FontCopier(styles.defaultFont()).italic().get()))));
  table.setSpacingBefore(10f);
  table.setSpacingAfter(10f);
  emitterContext.append(table);
}

相关文章