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


Java PdfPCell.setColspan方法代码示例

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


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

示例1: createGridColumnHeader

import com.itextpdf.text.pdf.PdfPCell; //导入方法依赖的package包/类
private void createGridColumnHeader(PdfPTable table, Collection<ColumnHeader> topHeaders, int maxHeaderLevel) throws Exception {
	for (int i = 1; i < 50; i++) {
		List<ColumnHeader> result = new ArrayList<ColumnHeader>();
		generateGridHeadersByLevel(topHeaders, i, result);
		for (ColumnHeader header : result) {
			PdfPCell cell = new PdfPCell(createParagraph(header));
			if (header.getBgColor() != null) {
				int[] colors = header.getBgColor();
				cell.setBackgroundColor(new BaseColor(colors[0], colors[1], colors[2]));
			}
			cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
			cell.setHorizontalAlignment(header.getAlign());
			cell.setColspan(header.getColspan());
			if (header.getColumnHeaders().size() == 0) {
				int rowspan = maxHeaderLevel - (header.getLevel() - 1);
				if (rowspan > 0) {
					cell.setRowspan(rowspan);
				}
			}
			table.addCell(cell);
		}
	}
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:24,代码来源:AbstractPdfReportBuilder.java

示例2: createCell

import com.itextpdf.text.pdf.PdfPCell; //导入方法依赖的package包/类
public PdfPCell createCell(String value, Font font, int align, int colspan, boolean boderFlag) {
    PdfPCell cell = new PdfPCell();
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    cell.setHorizontalAlignment(align);
    cell.setColspan(colspan);
    cell.setPhrase(new Phrase(value, font));
    cell.setPadding(3.0f);
    if (!boderFlag) {
        cell.setBorder(0);
        cell.setPaddingTop(15.0f);
        cell.setPaddingBottom(8.0f);
    }
    return cell;
}
 
开发者ID:melonlee,项目名称:PowerApi,代码行数:15,代码来源:PDFTest.java

示例3: createColumnItem

import com.itextpdf.text.pdf.PdfPCell; //导入方法依赖的package包/类
private PdfPCell createColumnItem(PDFSerialiser pSerialiser, EvaluatedNodeInfo pEvalNode,
                                  LayoutFieldValueMappingItemColumn pColumnItem, int pItemsPerRow, boolean pHideField) {
  ElementAttributes lElementAttributes = pSerialiser.getInheritedElementAttributes();
  pSerialiser.getCSSResolver().resolveStyles(lElementAttributes, MULTI_OPTION_CELL_TAG,
                                             getColumnItemClasses(pEvalNode), getColumnItemStyles(pEvalNode));
  pSerialiser.pushElementAttributes(lElementAttributes);

  PdfPCell lFieldCell = pSerialiser.getElementFactory().getCell();
  Paragraph lCellParagraph = pSerialiser.getElementFactory().getParagraph();
  lFieldCell.setColspan(FOXGridUtils.calculateAdjustedColumnSpan(pColumnItem.getColSpan(), pItemsPerRow));

  pSerialiser.startContainer(ElementContainerFactory.getContainer(lFieldCell, lCellParagraph));
  addColumnItemContent(pSerialiser, pColumnItem, pHideField);
  pSerialiser.endContainer();

  pSerialiser.popElementAttributes();

  return lFieldCell;
}
 
开发者ID:Fivium,项目名称:FOXopen,代码行数:20,代码来源:MultiOptionSelectWidget.java

示例4: addColumnItem

import com.itextpdf.text.pdf.PdfPCell; //导入方法依赖的package包/类
/**
 * Serialises a table cell of the column item content with cell styles applied
 * @param pSerialisationContext
 * @param pSerialiser
 * @param pColumnItem The column item to create a cell for
 * @param pFormColumns The number of columns in the form, used to determine field column spans
 */
private void addColumnItem(SerialisationContext pSerialisationContext, PDFSerialiser pSerialiser, LayoutWidgetItemColumn pColumnItem, int pFormColumns) {
  ElementAttributes lElementAttributes = pSerialiser.getInheritedElementAttributes();
  pSerialiser.getCSSResolver().resolveStyles(lElementAttributes, FORM_CELL_TAG, getColumnItemCellClasses(pColumnItem), getColumnItemCellStyles(pColumnItem));
  pSerialiser.pushElementAttributes(lElementAttributes);

  PdfPCell lFormCell = pSerialiser.getElementFactory().getCell();
  Paragraph lCellParagraph = pSerialiser.getElementFactory().getParagraph();
  lFormCell.setColspan(FOXGridUtils.calculateAdjustedColumnSpan(pColumnItem.getColSpan(), pFormColumns));

  pSerialiser.startContainer(ElementContainerFactory.getContainer(lFormCell, lCellParagraph));
  addColumnItemContent(pSerialisationContext, pSerialiser, pColumnItem);
  pSerialiser.endContainer();

  pSerialiser.add(lFormCell);
  pSerialiser.popElementAttributes();
}
 
开发者ID:Fivium,项目名称:FOXopen,代码行数:24,代码来源:FormWidget.java

示例5: buildComponent

import com.itextpdf.text.pdf.PdfPCell; //导入方法依赖的package包/类
@Override
public void buildComponent(SerialisationContext pSerialisationContext, PDFSerialiser pSerialiser, EvaluatedGridCellPresentationNode pEvalNode) {
  ElementAttributes lElementAttributes = pSerialiser.getInheritedElementAttributes();
  pSerialiser.getCSSResolver().resolveStyles(lElementAttributes, GRID_CELL_TAG,
                                             Arrays.asList(GRID_CELL_CLASS, pEvalNode.getClasses()),
                                             Collections.singletonList(pEvalNode.getStyles()));
  pSerialiser.pushElementAttributes(lElementAttributes);

  PdfPCell lCell = pSerialiser.getElementFactory().getCell();
  Paragraph lCellParagraph = pSerialiser.getElementFactory().getParagraph();
  lCell.setColspan(pEvalNode.getColumnSpan());

  pSerialiser.startContainer(ElementContainerFactory.getContainer(lCell, lCellParagraph));
  processChildren(pSerialisationContext, pSerialiser, pEvalNode);
  pSerialiser.endContainer();
  pSerialiser.add(lCell);

  pSerialiser.popElementAttributes();
}
 
开发者ID:Fivium,项目名称:FOXopen,代码行数:20,代码来源:GridCellComponentBuilder.java

示例6: addCellToTableCzech

import com.itextpdf.text.pdf.PdfPCell; //导入方法依赖的package包/类
/**
 * <a href="http://stackoverflow.com/questions/44005834/changing-rowspans">
 * Changing rowspans
 * </a>
 * <p>
 * Helper method of the OP.
 * </p>
 * @see #testUseRowspanLikeUser7968180()
 * @see #testUseRowspanLikeUser7968180Fixed()
 * @see #createPdf(String)
 * @see #createPdfFixed(String)
 */
private static void addCellToTableCzech(PdfPTable table, int horizontalAlignment,
        int verticalAlignment, String value, int colspan, int rowspan,
        String fontType, float fontSize) {
    BaseFont base = null;
    try {
        base = BaseFont.createFont(fontType, BaseFont.CP1250, BaseFont.EMBEDDED);
    } catch (Exception e) {
        e.printStackTrace();
    }
    Font font = new Font(base, fontSize);
    PdfPCell cell = new PdfPCell(new Phrase(value, font));
    cell.setColspan(colspan);
    cell.setRowspan(rowspan);
    cell.setHorizontalAlignment(horizontalAlignment);
    cell.setVerticalAlignment(verticalAlignment);
    cell.setBorder(PdfPCell.NO_BORDER);
    table.addCell(cell);
}
 
开发者ID:mkl-public,项目名称:testarea-itext5,代码行数:31,代码来源:UseRowspan.java

示例7: generateSectionTitle

import com.itextpdf.text.pdf.PdfPCell; //导入方法依赖的package包/类
private void generateSectionTitle(PdfPTable table, Data data) throws IOException, DocumentException {
    if (!this.currentSection.equals(data.mountains)) {
        currentSection = data.mountains;
        currentBackgroundColor = backgroundColorGenerator.generate(data);

        PdfPCell cellSeparator = new PdfPCell(PhraseUtil.phrase(" "));
        cellSeparator.setBorder(0);
        cellSeparator.setPadding(10);
        cellSeparator.setColspan(4);
        table.addCell(cellSeparator);

        PdfPCell cell = new PdfPCell(PhraseUtil.phrase(currentSection, 14, Font.BOLD));
        cell.setBorder(0);
        cell.setPadding(10);
        cell.setHorizontalAlignment(Element.ALIGN_LEFT);
        cell.setColspan(4);
        cell.setBackgroundColor(currentBackgroundColor);
        table.addCell(cell);
    }
}
 
开发者ID:lenrok258,项目名称:MountainQuest-PL,代码行数:21,代码来源:TableOfContentsPageGenerator.java

示例8: generateFooter

import com.itextpdf.text.pdf.PdfPCell; //导入方法依赖的package包/类
private PdfPCell generateFooter() throws IOException, DocumentException, URISyntaxException {

        PdfPCell cell = new PdfPCell();
        cell.setColspan(12);
        cell.setVerticalAlignment(Element.ALIGN_BOTTOM);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setBorder(0);
        cell.setPadding(0);

        PdfPTable innerTable = new PdfPTable(2);
        innerTable.getDefaultCell().setBorder(0);
        innerTable.setWidths(new int[]{1, 1});
        innerTable.setWidthPercentage(100);
        innerTable.addCell(generateStamp());
        innerTable.addCell(new PageNumberCellGenerator(pageNumber, backgroundColor).generateTile());

        cell.addElement(innerTable);
        return cell;
    }
 
开发者ID:lenrok258,项目名称:MountainQuest-PL,代码行数:20,代码来源:DataPageGenerator.java

示例9: generateMapImage

import com.itextpdf.text.pdf.PdfPCell; //导入方法依赖的package包/类
private PdfPCell generateMapImage() throws IOException, DocumentException {
    PdfPCell cell = new PdfPCell(imageMap(data.mapUrl), true);
    cell.setBorder(0);
    cell.setPaddingTop(10);
    cell.setPaddingBottom(10);
    cell.setPaddingLeft(5);
    cell.setColspan(6);
    return cell;
}
 
开发者ID:lenrok258,项目名称:MountainQuest-PL,代码行数:10,代码来源:DataPageGenerator.java

示例10: buildHeaderNameLine

import com.itextpdf.text.pdf.PdfPCell; //导入方法依赖的package包/类
public static PdfPTable buildHeaderNameLine(String schuelername, Font headerFont) throws DocumentException {
	PdfPCell labelCell = new PdfPCell(new Phrase("Name", headerFont));
	labelCell.setBorder(Rectangle.BOTTOM);
	labelCell.setBorderWidth(1f);

	PdfPCell nameCell = new PdfPCell(new Phrase(schuelername, headerFont));
	nameCell.setBorder(Rectangle.BOTTOM);
	nameCell.setBorderWidth(1f);
	nameCell.setColspan(5);
	
	PdfPTable table = prebuildHeaderTable();
	table.addCell(labelCell);
	table.addCell(nameCell);
	
	return table;
}
 
开发者ID:fossaag,项目名称:rolp,代码行数:17,代码来源:PdfFormatHelper.java

示例11: process

import com.itextpdf.text.pdf.PdfPCell; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void process(int level, Node node, InvocationContext context) {
    TreeNavigation nav = context.treeNavigation();
    boolean isHeaderCell = nav.ancestorTreeMatches(TableCellNode.class, TableRowNode.class, TableHeaderNode.class);

    CellStyler cellStyler = context.peekCellStyler();
    context.pushFont(cellStyler.cellFont());
    List<Element> elements = context.collectChildren(level, node);
    context.popFont();

    Phrase phrase = new Phrase();
    phrase.addAll(elements);

    int colspan = ((TableCellNode) node).getColSpan();

    PdfPCell cell = isHeaderCell ? headerCell(phrase) : new PdfPCell(phrase);
    cell.setColspan(colspan);
    cellStyler.applyStyle(cell);

    context.append(cell);
}
 
开发者ID:Arnauld,项目名称:gutenberg,代码行数:23,代码来源:TableCellNodeProcessor.java

示例12: insertCell

import com.itextpdf.text.pdf.PdfPCell; //导入方法依赖的package包/类
/**
 * Insert New row to the table
 *
 * @param table
 * @param text
 * @param align
 * @param colspan
 * @param font
 */
private void insertCell(PdfPTable table, String text, int align, int colspan, Font font) {

    //create a new cell with the specified Text and Font
    PdfPCell cell = new PdfPCell(new Phrase(text.trim(), font));
    //set the cell alignment
    cell.setHorizontalAlignment(align);
    //set the cell column span in case you want to merge two or more cells
    cell.setColspan(colspan);
    //in case there is no text and you wan to create an empty row
    if (text.trim().equalsIgnoreCase("")) {
        cell.setMinimumHeight(10f);
    }
    //add the call to the table
    table.addCell(cell);
}
 
开发者ID:budthapa,项目名称:Create-PDF-in-Java-,代码行数:25,代码来源:createPDF.java

示例13: createHeader

import com.itextpdf.text.pdf.PdfPCell; //导入方法依赖的package包/类
private void createHeader(final PdfPTable table,
                          final String challengeTitle,
                          final String catTitle,
                          final String division,
                          final String judgingGroup,
                          final Tournament tournament)
    throws BadElementException {
  final PdfPCell tournamentCell = PdfUtils.createHeaderCell(String.format("%s - %s", challengeTitle,
                                                                          tournament.getDescription()));
  tournamentCell.setColspan(4);
  table.addCell(tournamentCell);

  final PdfPCell categoryHeader = PdfUtils.createHeaderCell(String.format("Category: %s - Award Group: %s - JudgingGroup: %s",
                                                                          catTitle, division, judgingGroup));
  categoryHeader.setColspan(4);
  table.addCell(categoryHeader);

  table.addCell(PdfUtils.createHeaderCell(TournamentSchedule.TEAM_NUMBER_HEADER));
  table.addCell(PdfUtils.createHeaderCell(TournamentSchedule.TEAM_NAME_HEADER));
  table.addCell(PdfUtils.createHeaderCell(TournamentSchedule.ORGANIZATION_HEADER));
  table.addCell(PdfUtils.createHeaderCell("Scaled Score"));

  table.setHeaderRows(3);
}
 
开发者ID:jpschewe,项目名称:fll-sw,代码行数:25,代码来源:CategoryScoresByScoreGroup.java

示例14: createStringCell

import com.itextpdf.text.pdf.PdfPCell; //导入方法依赖的package包/类
private PdfPCell createStringCell(PdfPTable table, String text, ExcelExportEntity entity,
                                  int rowHeight, int colspan, int rowspan) {
    PdfPCell iCell = new PdfPCell(new Phrase(text, styler.getFont(entity, text)));
    styler.setCellStyler(iCell, entity, text);
    iCell.setFixedHeight((int) (rowHeight * 2.5));
    if (colspan > 1) {
        iCell.setColspan(colspan);
    }
    if (rowspan > 1) {
        iCell.setRowspan(rowspan);
    }
    table.addCell(iCell);
    return iCell;
}
 
开发者ID:rushingpig,项目名称:poix,代码行数:15,代码来源:PdfExportServer.java

示例15: generateTableOfContentsTitle

import com.itextpdf.text.pdf.PdfPCell; //导入方法依赖的package包/类
private PdfPCell generateTableOfContentsTitle() throws IOException, DocumentException {
    PdfPCell cell = new PdfPCell(PhraseUtil.phrase("Spis treści", 18, Font.BOLD));
    cell.setBorder(0);
    cell.setPaddingBottom(10);
    cell.setHorizontalAlignment(Element.ALIGN_LEFT);
    cell.setColspan(4);
    return cell;
}
 
开发者ID:lenrok258,项目名称:MountainQuest-PL,代码行数:9,代码来源:TableOfContentsPageGenerator.java


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