當前位置: 首頁>>代碼示例>>Java>>正文


Java PdfPTable類代碼示例

本文整理匯總了Java中com.itextpdf.text.pdf.PdfPTable的典型用法代碼示例。如果您正苦於以下問題:Java PdfPTable類的具體用法?Java PdfPTable怎麽用?Java PdfPTable使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


PdfPTable類屬於com.itextpdf.text.pdf包,在下文中一共展示了PdfPTable類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: cellRodape

import com.itextpdf.text.pdf.PdfPTable; //導入依賴的package包/類
private PdfPTable cellRodape(String value, boolean l,boolean r,int align)
{
    Font fontCorpoTableO= FontFactory.getFont(Fontes.FONT, BaseFont.WINANSI, BaseFont.EMBEDDED ,7.5f);
    PdfPTable pTable = new PdfPTable(1);
    pTable.setWidthPercentage(100f);
    PdfPCell cellValue = new PdfPCell(new Phrase(value,fontCorpoTableO));
    if(l){cellValue.setBorderWidthLeft(0);}
    if(r){cellValue.setBorderWidthRight(0);}
   switch (align) 
   {
       case Element.ALIGN_RIGHT:cellValue.setHorizontalAlignment(Element.ALIGN_RIGHT);break;
       case Element.ALIGN_LEFT:cellValue.setHorizontalAlignment(Element.ALIGN_LEFT);break;
       case Element.ALIGN_CENTER:cellValue.setHorizontalAlignment(Element.ALIGN_CENTER);break;
       default:break;
   }
    pTable.addCell(cellValue);
    return pTable;
}
 
開發者ID:JIGAsoftSTP,項目名稱:NICON,代碼行數:19,代碼來源:ExporOnlyViagemPdf.java

示例2: generatePage

import com.itextpdf.text.pdf.PdfPTable; //導入依賴的package包/類
@Override
public PdfPTable generatePage() throws Exception {
    Image image = Image.getInstance(imageFile.toURL());
    float heightToWidthRatio = (210f / 297f);
    Image imageCropped = ImageUtils.cropImageToMeetRatio(pdfWriter, image, heightToWidthRatio);

    PdfPCell cell = new PdfPCell(imageCropped, true);
    cell.setBorder(0);
    cell.setPadding(COVER_MARGIN);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    cell.setExtraParagraphSpace(0);
    cell.setRightIndent(0);

    PdfPTable table = new PdfPTable(1);
    ;
    table.setWidthPercentage(100f);
    table.setWidths(new int[]{1});
    table.setExtendLastRow(true);
    table.addCell(cell);

    return table;
}
 
開發者ID:lenrok258,項目名稱:MountainQuest-PL,代碼行數:24,代碼來源:CoverPageGenerator.java

示例3: createGridColumnHeader

import com.itextpdf.text.pdf.PdfPTable; //導入依賴的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

示例4: serialise

import com.itextpdf.text.pdf.PdfPTable; //導入依賴的package包/類
/**
 * Serialise the input field div and content
 * @param pSerialisationContext
 * @param pSerialiser
 * @param pEvalNode
 */
public void serialise(SerialisationContext pSerialisationContext, PDFSerialiser pSerialiser, EN pEvalNode) {
  ElementAttributes lElementAttributes = pSerialiser.getInheritedElementAttributes();
  pSerialiser.getCSSResolver().resolveStyles(lElementAttributes, INPUT_FIELD_TAG, getInputFieldClasses(), Collections.emptyList());
  pSerialiser.pushElementAttributes(lElementAttributes);

  PdfPTable lTable = pSerialiser.getElementFactory().getTable(1);
  PdfPCell lCell = pSerialiser.getElementFactory().getCell();
  Paragraph lCellParagraph = pSerialiser.getElementFactory().getParagraph();

  pSerialiser.startContainer(ElementContainerFactory.getContainer(lCell, lCellParagraph));
  mInputFieldContent.addContent(pSerialisationContext, pSerialiser, pEvalNode);
  if (lCellParagraph.isEmpty()) {
    // If there is no cell content in all cells in a table row, the row will be 0 height - add a zero width space to
    // ensure that the input field div isn't collapsed like this (the height will be determined from the cell
    // paragraph font)
    lCellParagraph.add(ZERO_WIDTH_SPACE_CHARACTER);
  }
  pSerialiser.endContainer();

  lTable.addCell(lCell);
  pSerialiser.add(lTable);

  pSerialiser.popElementAttributes();
}
 
開發者ID:Fivium,項目名稱:FOXopen,代碼行數:31,代碼來源:InputField.java

示例5: onEndPage

import com.itextpdf.text.pdf.PdfPTable; //導入依賴的package包/類
@Override
public void onEndPage(PdfWriter writer, Document document) {
	PdfPTable table = new PdfPTable(2);
	table.setTotalWidth(527);
	table.setWidthPercentage(100);
	table.setLockedWidth(true);
	table.getDefaultCell().setFixedHeight(105f);
	table.getDefaultCell().setBorderWidth(0);
	table.addCell("");			
	table.addCell(csmLogoImage);
	table.writeSelectedRows(0, -1, 100, 840, writer.getDirectContent());
	ColumnText.showTextAligned(writer.getDirectContent(),
                   Element.ALIGN_LEFT, 
                   new Phrase(lebData.getSchuelername() + " " + lebData.getSchuljahr() + " " + lebData.getSchulhalbjahr().getId() + " Seite " + document.getPageNumber(), fusszeilenFont),
                   100, 75, 0);
}
 
開發者ID:fossaag,項目名稱:rolp,代碼行數:17,代碼來源:LebPageHelper.java

示例6: createGridTableDatas

import com.itextpdf.text.pdf.PdfPTable; //導入依賴的package包/類
private void createGridTableDatas(PdfPTable table, Collection<ReportData> datas) {
	for (ReportData data : datas) {
		PdfPCell cell = new PdfPCell(createParagraph(data.getTextChunk()));
		cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
		int level = this.calculateIndentationCount(data.getTextChunk().getText());
		if (data.getBgColor() != null) {
			int[] colors = data.getBgColor();
			cell.setBackgroundColor(new BaseColor(colors[0], colors[1], colors[2]));
		}
		if (level == 0) {
			cell.setHorizontalAlignment(data.getAlign());
		} else {
			cell.setIndent(20 * level);
		}
		table.addCell(cell);
	}
}
 
開發者ID:bsteker,項目名稱:bdf2,代碼行數:18,代碼來源:AbstractPdfReportBuilder.java

示例7: createAccomodationTableHeaders

import com.itextpdf.text.pdf.PdfPTable; //導入依賴的package包/類
private void createAccomodationTableHeaders(PdfPTable accomodationsTable) {
	PdfPCell numberHeader = new PdfPCell(new Paragraph("Lp."));
	PdfPCell roomNumberHeader = new PdfPCell(new Paragraph("Nr pokoju"));
	PdfPCell dateFromHeader = new PdfPCell(new Paragraph("Od"));
	PdfPCell dateToHeader = new PdfPCell(new Paragraph("Do"));
	PdfPCell placesHeader = new PdfPCell(new Paragraph("Miejsca"));
	PdfPCell roomTypeHeader = new PdfPCell(new Paragraph("Typ"));
	PdfPCell roomPriceHeader = new PdfPCell(new Paragraph("Cena"));
	accomodationsTable.addCell(numberHeader);
	accomodationsTable.addCell(roomNumberHeader);
	accomodationsTable.addCell(dateFromHeader);
	accomodationsTable.addCell(dateToHeader);
	accomodationsTable.addCell(placesHeader);
	accomodationsTable.addCell(roomTypeHeader);
	accomodationsTable.addCell(roomPriceHeader);
}
 
開發者ID:marcin-pwr,項目名稱:hotel,代碼行數:17,代碼來源:ResidenceService.java

示例8: createofferInstancesTableContent

import com.itextpdf.text.pdf.PdfPTable; //導入依賴的package包/類
private void createofferInstancesTableContent(List<OfferInstance> offerInstances, PdfPTable offerInstancesTable) {
	DecimalFormat decimalFormat = new DecimalFormat(PRICE_DECIMAL_FORMAT);

	int i = 1;
	for (OfferInstance offerInstance : offerInstances) {
		Offer offer = offerInstance.getOffer();

		PdfPCell numberCell = new PdfPCell(new Paragraph(String.valueOf(i++)));

		String offerName = offer.getName();
		PdfPCell roomNumberCell = new PdfPCell(new Paragraph(offerName));

		String offerPrice = decimalFormat.format(offer.getBaseValue()) + " PLN";
		PdfPCell roomPriceCell = new PdfPCell(new Paragraph(offerPrice));

		offerInstancesTable.addCell(numberCell);
		offerInstancesTable.addCell(roomNumberCell);
		offerInstancesTable.addCell(roomPriceCell);
	}

}
 
開發者ID:marcin-pwr,項目名稱:hotel,代碼行數:22,代碼來源:ResidenceService.java

示例9: createTableContent

import com.itextpdf.text.pdf.PdfPTable; //導入依賴的package包/類
private void createTableContent(List<CleaningSchedule> cleaningSchedules, PdfPTable cleaningScheduleTable) {
	int i = 1;
	for (CleaningSchedule cleaningSchedule : cleaningSchedules) {
		PdfPCell numberCell = new PdfPCell(new Paragraph(String.valueOf(i++)));
		String roomNumber = cleaningSchedule.getAccomodation().getAllocationEntity().getNumber();
		PdfPCell roomNumberCell = new PdfPCell(new Paragraph(roomNumber));
		String preferredTime = cleaningSchedule.getDesiredTime() == null ? "-" : cleaningSchedule.getDesiredTime().toString("HH:mm");
		PdfPCell preferredTimeCell = new PdfPCell(new Paragraph(preferredTime));
		String note = cleaningSchedule.getNote() == null ? "-" : cleaningSchedule.getNote();
		PdfPCell noteCell = new PdfPCell(new Paragraph(note));
		cleaningScheduleTable.addCell(numberCell);
		cleaningScheduleTable.addCell(roomNumberCell);
		cleaningScheduleTable.addCell(preferredTimeCell);
		cleaningScheduleTable.addCell(noteCell);
	}
}
 
開發者ID:marcin-pwr,項目名稱:hotel,代碼行數:17,代碼來源:EmployeeService.java

示例10: putSignature

import com.itextpdf.text.pdf.PdfPTable; //導入依賴的package包/類
private void putSignature(PdfPTable table, Context context) throws Exception {
	String uploadOid = (String)context.get("uploadSignatureOid");
	if ( StringUtils.isBlank(uploadOid) ) {
		return;
	}
	byte[] imageBytes = UploadSupportUtils.getDataBytes( uploadOid );
	if ( null == imageBytes ) {
		return;
	}
	Image signatureImgObj = Image.getInstance( imageBytes );
	signatureImgObj.setWidthPercentage(40f);
	PdfPCell cell = new PdfPCell();
	cell.setBorder( Rectangle.NO_BORDER );
	cell.addElement(signatureImgObj);
	table.addCell(cell);		
}
 
開發者ID:billchen198318,項目名稱:bamboobsc,代碼行數:17,代碼來源:PersonalReportPdfCommand.java

示例11: createLawTable

import com.itextpdf.text.pdf.PdfPTable; //導入依賴的package包/類
private PdfPTable createLawTable(PdfContentByte cb) throws DocumentException {
    PdfPTable table = new PdfPTable(1);
    float[] rows = { 445f };
    table.setTotalWidth(rows);
    table.getDefaultCell()
         .setBorder(Rectangle.NO_BORDER);
    table.getDefaultCell()
         .setLeading(8f, 0);

    table.addCell(new Phrase(new Chunk("Es handelt sich nicht um den Verzicht auf Erstattung von Aufwendungen.", textFontLawText)));
    table.addCell(new Phrase(new Chunk("Die Gesellschaft ist wegen Förderung (begünstigter Zweck: Umweltschutz (§52 (2) S. 1 Nr.(n) 8 AO)) durch", textFontLawText)));
    table.addCell(new Phrase(new Chunk("Bescheinigung des Finanzamt Halle (Saale)-Nord, StNr. 110/108/91169, vom 19.11.2008 ab 01.01.2009", textFontLawText)));
    table.addCell(new Phrase(new Chunk("als gemeinnützig anerkannt. Letzter Freistellungsbescheid datiert auf den 20.06.2013.", textFontLawText)));
    table.addCell(new Phrase(new Chunk("Es wird bestätigt, dass die Zuwendung nur zur Förderung des Umweltschutzes verwendet wird.", textFontLawText)));

    PdfPCell emptyCell = new PdfPCell();
    emptyCell.setBorder(Rectangle.BOTTOM);
    emptyCell.setFixedHeight(15f);
    table.addCell(emptyCell);

    return table;
}
 
開發者ID:Dica-Developer,項目名稱:weplantaforest,代碼行數:23,代碼來源:PdfReceiptView.java

示例12: process

import com.itextpdf.text.pdf.PdfPTable; //導入依賴的package包/類
@Override
public void process(int level, Node node, InvocationContext context) {

    TableNode tableNode = (TableNode) node;
    List<TableColumnNode> tableNodeColumns = tableNode.getColumns();

    PdfPTable table = new PdfPTable(tableNodeColumns.size());
    for (PdfPTableEvent tableEvent : tableEvents) {
        table.setTableEvent(tableEvent);
    }
    context.pushTable(new TableInfos(table, tableNodeColumns));
    context.processChildren(level, node);
    context.popTable();


    KeyValues kvs = context.iTextContext().keyValues();

    Float spacingBefore = kvs.<Float>getNullable(TABLE_SPACING_BEFORE).or(5f);
    Float spacingAfter = kvs.<Float>getNullable(TABLE_SPACING_AFTER).or(5f);
    table.setSpacingBefore(spacingBefore);
    table.setSpacingAfter(spacingAfter);

    applyAttributes(context, table);
    context.append(table);
}
 
開發者ID:Arnauld,項目名稱:gutenberg,代碼行數:26,代碼來源:TableNodeProcessor.java

示例13: addContent

import com.itextpdf.text.pdf.PdfPTable; //導入依賴的package包/類
private void addContent(PdfPTable table) {
    if (!SelectionRepository.noBaseData())
        addBaseData(table);
    if (SelectionRepository.summary)
        addSummary(table);
    if (!SelectionRepository.noExperience())
        addWorkExperience(table);
    if (!SelectionRepository.noSkills())
        addSkills(table);
    if (!SelectionRepository.noAccomplishments())
        addAccomplishments(table);
    if (SelectionRepository.languages)
        addLanguages(table);
    if (SelectionRepository.education)
        addEducation(table);
    if (SelectionRepository.additionalInfo)
        addAdditionalInfo(table);
    if (SelectionRepository.interests)
        addInterests(table);
}
 
開發者ID:victorward,項目名稱:recruitervision,代碼行數:21,代碼來源:PDFCreator.java

示例14: addBaseData

import com.itextpdf.text.pdf.PdfPTable; //導入依賴的package包/類
private void addBaseData(PdfPTable table) {
    addSectionName(table, "Base data");
    if (SelectionRepository.nameSurname)
        addNameMiddleSurname(table);
    if (SelectionRepository.gender)
        addGender(table);
    if (SelectionRepository.email)
        addEmail(table);
    if (SelectionRepository.cityCountry)
        addCityAndCountry(table);
    if (SelectionRepository.phones)
        addPhones(table);
    if (SelectionRepository.jobTitles)
        addJobTitles(table);
    if (SelectionRepository.urls)
        addUrls(table);
}
 
開發者ID:victorward,項目名稱:recruitervision,代碼行數:18,代碼來源:PDFCreator.java

示例15: onEndPage

import com.itextpdf.text.pdf.PdfPTable; //導入依賴的package包/類
/**
 * Adds a header to every page
 * @see com.itextpdf.text.pdf.PdfPageEventHelper#onEndPage(
 *      com.itextpdf.text.pdf.PdfWriter, com.itextpdf.text.Document)
 */
public void onEndPage(PdfWriter writer, Document document) {
	PdfPTable table = new PdfPTable(3);
	try {
		table.setWidths(new int[]{40,5,10});
		table.setTotalWidth(100);
		table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
		table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT);
		Font font=new Font(chineseFont,8);
		font.setColor(new BaseColor(55,55,55));
		Paragraph paragraph=new Paragraph("第   "+writer.getPageNumber()+" 頁   共",font);
		paragraph.setAlignment(Element.ALIGN_RIGHT);
		table.addCell(paragraph);
		Image img=Image.getInstance(total);
		img.scaleAbsolute(28, 28);
		PdfPCell cell = new PdfPCell(img);
		cell.setBorder(Rectangle.NO_BORDER);
		cell.setHorizontalAlignment(Element.ALIGN_CENTER);
		table.addCell(cell);
		PdfPCell c = new PdfPCell(new Paragraph("頁",font));
		c.setHorizontalAlignment(Element.ALIGN_LEFT);
		c.setBorder(Rectangle.NO_BORDER);
		table.addCell(c);
		float center=(document.getPageSize().getWidth())/2-120/2;
		table.writeSelectedRows(0, -1,center,30, writer.getDirectContent());
	}
	catch(DocumentException de) {
		throw new ExceptionConverter(de);
	}
}
 
開發者ID:bsteker,項目名稱:bdf2,代碼行數:35,代碼來源:PdfReportPageNumber.java


注:本文中的com.itextpdf.text.pdf.PdfPTable類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。