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


Java PdfPTable.writeSelectedRows方法代码示例

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


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

示例1: onEndPage

import com.lowagie.text.pdf.PdfPTable; //导入方法依赖的package包/类
@Override
public void onEndPage(PdfWriter writer, Document document) {
    try {
        Rectangle page = document.getPageSize();
        PdfPTable footer = new PdfPTable(1);
        footer.setWidthPercentage(100);
        footer.setSpacingBefore(20);
        PdfPCell footerPageNocell = new PdfPCell(new Paragraph(fontFamilySelector.process(messageSource.getMessage("hrms.payroll.computer.generated.payslip.not.require.signature", null, this.locale), FontContext.REGULAR_NORMAL_TIMES_NEW_ROMAN)));
        footerPageNocell.setBorder(0);
        footerPageNocell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        footer.addCell(footerPageNocell);
        footer.setTotalWidth(page.getWidth() - document.leftMargin() - document.rightMargin());
        footer.writeSelectedRows(0, -1, document.leftMargin(), document.bottomMargin()+2 , writer.getDirectContent());

    } catch (Exception e) {
        throw new ExceptionConverter(e);
    }
}
 
开发者ID:mobilipia,项目名称:Deskera-HRMS,代码行数:19,代码来源:ExportSalarySlipService.java

示例2: onEndPage

import com.lowagie.text.pdf.PdfPTable; //导入方法依赖的package包/类
@Override
public void onEndPage(PdfWriter writer, Document document) {
    try {
        Rectangle page = document.getPageSize();
        PdfPTable footer = new PdfPTable(1);
        footer.setWidthPercentage(100);
        footer.setSpacingBefore(20);
        String FootPager = String.valueOf(document.getPageNumber());//current page no
        PdfPCell footerPageNocell = new PdfPCell(new Phrase(FootPager, fontSmallBold));
        footerPageNocell.setBorder(0);
        footerPageNocell.setPaddingBottom(5);
        footerPageNocell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        footer.addCell(footerPageNocell);
        footer.setTotalWidth(page.getWidth() - document.leftMargin() - document.rightMargin());
        footer.writeSelectedRows(0, -1, document.leftMargin(), document.bottomMargin() - 5, writer.getDirectContent());

    } catch (Exception e) {
        throw new ExceptionConverter(e);
    }
}
 
开发者ID:mobilipia,项目名称:Deskera-HRMS,代码行数:21,代码来源:AppraisalDetails.java

示例3: onEndPage

import com.lowagie.text.pdf.PdfPTable; //导入方法依赖的package包/类
/**
 * @see com.lowagie.text.pdf.PdfPageEventHelper#onEndPage(com.lowagie.text.pdf.PdfWriter,
 *      com.lowagie.text.Document)
 */
public void onEndPage(PdfWriter writer, Document document) {
	try {
		Rectangle page = document.getPageSize();
		PdfPTable head = new PdfPTable(3);
		for (int k = 1; k <= 6; ++k)
			head.addCell("head " + k);
		head.setTotalWidth(page.getWidth() - document.leftMargin()
				- document.rightMargin());
		head.writeSelectedRows(
				0,
				-1,
				document.leftMargin(),
				page.getHeight() - document.topMargin()
						+ head.getTotalHeight(), writer.getDirectContent());
		PdfPTable foot = new PdfPTable(3);
		for (int k = 1; k <= 6; ++k)
			foot.addCell("foot " + k);
		foot.setTotalWidth(page.getWidth() - document.leftMargin()
				- document.rightMargin());
		foot.writeSelectedRows(0, -1, document.leftMargin(),
				document.bottomMargin(), writer.getDirectContent());
	} catch (Exception e) {
		throw new ExceptionConverter(e);
	}
}
 
开发者ID:albfernandez,项目名称:itext2,代码行数:30,代码来源:EndPageTest.java

示例4: main

import com.lowagie.text.pdf.PdfPTable; //导入方法依赖的package包/类
/**
 * Break a large table up into several smaller tables for memory management
 * purposes.
 * 
 */
@Test
public void main() throws Exception {
	// step1
	Document document = new Document(PageSize.A4, 10, 10, 10, 10);
	// step2
	PdfWriter writer = PdfWriter.getInstance(document, PdfTestBase.getOutputStream("SplitTable.pdf"));
	// step3
	document.open();
	// step4

	PdfContentByte cb = writer.getDirectContent();
	PdfPTable table = new PdfPTable(10);
	for (int k = 1; k <= 100; ++k) {
		table.addCell("The number " + k);
	}
	table.setTotalWidth(800);
	table.writeSelectedRows(0, 5, 0, -1, 50, 650, cb);
	document.newPage();
	table.writeSelectedRows(5, -1, 0, -1, 50, 650, cb);
	document.close();

	// step5
	document.close();
}
 
开发者ID:albfernandez,项目名称:itext2,代码行数:30,代码来源:SplitTableTest.java

示例5: onEndPage

import com.lowagie.text.pdf.PdfPTable; //导入方法依赖的package包/类
/**
 * @see com.lowagie.text.pdf.PdfPageEventHelper#onEndPage(com.lowagie.text.pdf.PdfWriter, com.lowagie.text.Document)
 */
public void onEndPage(PdfWriter writer, Document document) {
    try {
        Rectangle page = document.getPageSize();

        if (headerFooterPolicy.getHeader(writer.getPageNumber())!=null) {
         Hdr hdr = headerFooterPolicy.getHeader(writer.getPageNumber()).getJaxbElement();
         PdfPTable head = new PdfPTable(1); // num cols	            
         // TODO - no cell borders
         traverseBlockLevelContent( hdr.getEGBlockLevelElts(), head);
         head.setTotalWidth(page.getWidth() - document.leftMargin() - document.rightMargin());
         head.writeSelectedRows(0, -1, document.leftMargin(), page.getHeight() - document.topMargin() + head.getTotalHeight(),
             writer.getDirectContent());
        }
        
        if (headerFooterPolicy.getFooter(writer.getPageNumber())!=null) {
         Ftr ftr = headerFooterPolicy.getFooter(writer.getPageNumber()).getJaxbElement();	            
         PdfPTable foot = new PdfPTable(1);
         traverseBlockLevelContent( ftr.getEGBlockLevelElts(), foot);
         foot.setTotalWidth(page.getWidth() - document.leftMargin() - document.rightMargin());
         foot.writeSelectedRows(0, -1, document.leftMargin(), document.bottomMargin(),
             writer.getDirectContent());
        }
    }
    catch (Exception e) {
        throw new ExceptionConverter(e);
    }
}
 
开发者ID:plutext,项目名称:docx4j-export-FO,代码行数:31,代码来源:Conversion.java

示例6: onEndPage

import com.lowagie.text.pdf.PdfPTable; //导入方法依赖的package包/类
/**
 * @see com.lowagie.text.pdf.PdfPageEventHelper#onEndPage(com.lowagie.text.pdf.PdfWriter,
 *      com.lowagie.text.Document)
 */
public void onEndPage(PdfWriter writer, Document document) {
	try {
		Rectangle page = document.getPageSize();
		PdfPTable head = new PdfPTable(3);
		for (int k = 1; k <= 6; ++k)
			head.addCell("head " + k);
		head.setTotalWidth(page.getWidth() - document.leftMargin() - document.rightMargin());
		head.writeSelectedRows(0, -1, document.leftMargin(), page.getHeight() - document.topMargin()
				+ head.getTotalHeight(), writer.getDirectContent());
		PdfPTable foot = new PdfPTable(3);
		for (int k = 1; k <= 6; ++k)
			foot.addCell("foot " + k);
		foot.setTotalWidth(page.getWidth() - document.leftMargin() - document.rightMargin());
		foot.writeSelectedRows(0, -1, document.leftMargin(), document.bottomMargin(), writer.getDirectContent());
	} catch (Exception e) {
		throw new ExceptionConverter(e);
	}
}
 
开发者ID:fc-dream,项目名称:PDFTestForAndroid,代码行数:23,代码来源:EndPage.java

示例7: onEndPage

import com.lowagie.text.pdf.PdfPTable; //导入方法依赖的package包/类
@Override
public void onEndPage(PdfWriter writer, Document document) {
    try {
        Rectangle page = document.getPageSize();
        PdfPTable footer = new PdfPTable(1);
        footer.setWidthPercentage(100);
        footer.setSpacingBefore(20);
        PdfPCell footerPageNocell = new PdfPCell(new Paragraph(fontFamilySelector.process(messageSource.getMessage("hrms.payroll.computer.generated.payslip.not.require.signature", null, RequestContextUtils.getLocale(request)), FontContext.SMALL_NORMAL_TIMES_NEW_ROMAN)));
        footerPageNocell.setBorder(0);
        footerPageNocell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        footer.addCell(footerPageNocell);
        footer.setTotalWidth(page.getWidth() - document.leftMargin() - document.rightMargin());
        footer.writeSelectedRows(0, -1, document.leftMargin(), document.bottomMargin()+2 , writer.getDirectContent());

    } catch (Exception e) {
        throw new ExceptionConverter(e);
    }
}
 
开发者ID:mobilipia,项目名称:Deskera-HRMS,代码行数:19,代码来源:ExportPayslipController.java

示例8: onEndPage

import com.lowagie.text.pdf.PdfPTable; //导入方法依赖的package包/类
@Override
public void onEndPage(PdfWriter writer, Document document) {
    try {
        Rectangle page = document.getPageSize();
        PdfPTable footer = new PdfPTable(1);
        footer.setWidthPercentage(100);
        footer.setSpacingBefore(20);
        String FootPager = String.valueOf(document.getPageNumber());//current page no
        PdfPCell footerPageNocell = new PdfPCell(new Phrase(fontFamilySelector.process(FootPager, FontContext.SMALL_BOLD_HELVETICA)));
        footerPageNocell.setBorder(0);
        footerPageNocell.setPaddingBottom(5);
        footerPageNocell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        footer.addCell(footerPageNocell);
        footer.setTotalWidth(page.getWidth() - document.leftMargin() - document.rightMargin());
        footer.writeSelectedRows(0, -1, document.leftMargin(), document.bottomMargin() - 5, writer.getDirectContent());

    } catch (Exception e) {
        throw new ExceptionConverter(e);
    }
}
 
开发者ID:mobilipia,项目名称:Deskera-HRMS,代码行数:21,代码来源:exportAppraisalReportPDFDAOImpl.java

示例9: main

import com.lowagie.text.pdf.PdfPTable; //导入方法依赖的package包/类
/**
 * General example using cell events.
 * 
 */
@Test
public void main() throws Exception {
	// step1
	Document document = new Document(PageSize.A4, 50, 50, 50, 50);
	// step2
	PdfWriter writer = PdfWriter.getInstance(document, PdfTestBase.getOutputStream("CellEvents.pdf"));
	// step3
	document.open();
	// step4
	CellEventsTest event = new CellEventsTest();
	Image im = Image.getInstance(PdfTestBase.RESOURCES_DIR + "otsoe.jpg");
	im.setRotationDegrees(30);
	PdfPTable table = new PdfPTable(4);
	table.addCell("text 1");
	PdfPCell cell = new PdfPCell(im, true);
	cell.setCellEvent(event);
	table.addCell(cell);
	table.addCell("text 3");
	im.setRotationDegrees(0);
	table.addCell(im);
	table.setTotalWidth(300);
	PdfContentByte cb = writer.getDirectContent();
	table.writeSelectedRows(0, -1, 50, 600, cb);
	table.setHeaderRows(3);
	document.add(table);

	// step5
	document.close();
}
 
开发者ID:albfernandez,项目名称:itext2,代码行数:34,代码来源:CellEventsTest.java

示例10: onEndPage

import com.lowagie.text.pdf.PdfPTable; //导入方法依赖的package包/类
/**
 * Generates the end page for this transaction report
 * 
 * @see com.lowagie.text.pdf.PdfPageEventHelper#onEndPage(com.lowagie.text.pdf.PdfWriter, com.lowagie.text.Document)
 */
public void onEndPage(PdfWriter writer, Document document) {
    try {
        Rectangle page = document.getPageSize();
        PdfPTable head = new PdfPTable(3);
        SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
        PdfPCell cell = new PdfPCell(new Phrase(sdf.format(runDate), headerFont));
        cell.setBorder(Rectangle.NO_BORDER);
        head.addCell(cell);

        cell = new PdfPCell(new Phrase(title, headerFont));
        cell.setBorder(Rectangle.NO_BORDER);
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        head.addCell(cell);

        cell = new PdfPCell(new Phrase("Page: " + new Integer(writer.getPageNumber()), headerFont));
        cell.setBorder(Rectangle.NO_BORDER);
        cell.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT);
        head.addCell(cell);

        head.setTotalWidth(page.width() - document.leftMargin() - document.rightMargin());
        head.writeSelectedRows(0, -1, document.leftMargin(), page.height() - document.topMargin() + head.getTotalHeight(), writer.getDirectContent());
    }
    catch (Exception e) {
        throw new ExceptionConverter(e);
    }
}
 
开发者ID:VU-libtech,项目名称:OLE-INST,代码行数:32,代码来源:TransactionReport.java

示例11: onEndPage

import com.lowagie.text.pdf.PdfPTable; //导入方法依赖的package包/类
/**
 * Writes the footer on the last page
 * 
 * @see com.lowagie.text.pdf.PdfPageEventHelper#onEndPage(com.lowagie.text.pdf.PdfWriter, com.lowagie.text.Document)
 */
public void onEndPage(PdfWriter writer, Document document) {
    try {
        Font titleFont = FontFactory.getFont(FontFactory.HELVETICA, 12, Font.NORMAL);
        Font font = FontFactory.getFont(FontFactory.HELVETICA, 8, Font.NORMAL);

        Rectangle page = document.getPageSize();
        PdfPTable head = new PdfPTable(3);

        int[] widths = { 15, 70, 15 };
        head.setWidths(widths);

        SimpleDateFormat sdf = new SimpleDateFormat(CamsConstants.DateFormats.MONTH_DAY_YEAR + " " + CamsConstants.DateFormats.MILITARY_TIME);

        PdfPCell cell = new PdfPCell(new Phrase(sdf.format(runDate), font));
        cell.setBorder(Rectangle.NO_BORDER);
        head.addCell(cell);

        cell = new PdfPCell(new Phrase(title, titleFont));
        cell.setBorder(Rectangle.NO_BORDER);
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        head.addCell(cell);

        cell = new PdfPCell(new Phrase("Page: " + new Integer(writer.getPageNumber()), font));
        cell.setBorder(Rectangle.NO_BORDER);
        cell.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT);
        head.addCell(cell);

        head.setTotalWidth(page.width() - document.leftMargin() - document.rightMargin());
        head.writeSelectedRows(0, -1, document.leftMargin(), page.height() - document.topMargin() + head.getTotalHeight(), writer.getDirectContent());
    }
    catch (Exception e) {
        throw new ExceptionConverter(e);
    }
}
 
开发者ID:kuali,项目名称:kfs,代码行数:40,代码来源:DepreciationReport.java

示例12: main

import com.lowagie.text.pdf.PdfPTable; //导入方法依赖的package包/类
/**
	 * Generates a StudentCard
	 * 
	 * @param args
	 *            no arguments needed here
	 */
	public static void main(String[] args) {

		System.out.println("StudentCard");

		// step 1: creation of a document-object
		Rectangle rect = new Rectangle(243, 153);
		rect.setBackgroundColor(new Color(0xFF, 0xFF, 0xCC));
		Document document = new Document(rect, 10, 10, 10, 10);

		try {

			// step 2:
			PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(android.os.Environment.getExternalStorageDirectory() + java.io.File.separator + "droidtext" + java.io.File.separator + "studentcard.pdf"));

			// step 3: we open the document
			document.open();

			// step 4:
			Font font = FontFactory.getFont(FontFactory.HELVETICA, 14, Font.BOLD, Color.BLUE);
			Paragraph p = new Paragraph("Ghent University", font);
			p.setAlignment(Element.ALIGN_CENTER);
			document.add(p);
			PdfContentByte cb = writer.getDirectContent();
			Font f = FontFactory.getFont(FontFactory.HELVETICA, 8);
			PdfPTable outertable = new PdfPTable(3);
			outertable.setTotalWidth(200);
			outertable.getDefaultCell().setBorder(Rectangle.NO_BORDER);
			float[] outer = { 60, 25, 15 };
			outertable.setWidths(outer);
			PdfPTable innertable = new PdfPTable(2);
			float[] inner = { 35, 65 };
			innertable.setWidths(inner);
			innertable.addCell(new Paragraph("name:", f));
			innertable.addCell(new Paragraph("Bruno Lowagie", f));
			innertable.addCell(new Paragraph("date of birth:", f));
			innertable.addCell(new Paragraph("June 10th, 1970", f));
			innertable.addCell(new Paragraph("Study Program:", f));
			innertable.addCell(new Paragraph("master in civil engineering", f));
			innertable.addCell(new Paragraph("option:", f));
			innertable.addCell(new Paragraph("architecture", f));
			outertable.addCell(innertable);
			outertable.getDefaultCell().setBackgroundColor(new Color(0xFF, 0xDE, 0xAD));
//			outertable.addCell(Image.getInstance("bruno.jpg"));
			ByteArrayOutputStream stream = new ByteArrayOutputStream();
			Bitmap bitmap = BitmapFactory.decodeResource(PdfTestRunner.getActivity().getResources(), R.drawable.bruno);
			bitmap.compress(Bitmap.CompressFormat.JPEG /* FileType */,
			                        100 /* Ratio */, stream);
			Image img = Image.getInstance(stream.toByteArray());
			outertable.addCell(img);
			BarcodeEAN codeEAN = new BarcodeEAN();
			codeEAN.setCodeType(Barcode.EAN13);
			codeEAN.setCode("8010012529736");
			Image imageEAN = codeEAN.createImageWithBarcode(cb, null, null);
			imageEAN.setRotationDegrees(90);
			outertable.getDefaultCell().setBackgroundColor(Color.WHITE);
			outertable.addCell(imageEAN);
			outertable.writeSelectedRows(0, -1, 20, 100, writer.getDirectContent());
		} catch (DocumentException de) {
			System.err.println(de.getMessage());
		} catch (IOException ioe) {
			System.err.println(ioe.getMessage());
		}

		// step 5: we close the document
		document.close();
	}
 
开发者ID:fc-dream,项目名称:PDFTestForAndroid,代码行数:73,代码来源:StudentCard.java

示例13: main

import com.lowagie.text.pdf.PdfPTable; //导入方法依赖的package包/类
/**
	 * General example using cell events.
	 * 
	 * @param args
	 *            no arguments needed
	 */
	public static void main(String[] args) {

		System.out.println("CellEvents");
		// step1
		Document document = new Document(PageSize.A4, 50, 50, 50, 50);
		try {
			// step2
			PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(android.os.Environment.getExternalStorageDirectory() + java.io.File.separator + "droidtext" + java.io.File.separator + "CellEvents.pdf"));
			// step3
			document.open();
			// step4
			CellEvents event = new CellEvents();
			//Can't use filename => use byte[] instead
//			Image img = Image.getInstance("otsoe.jpg");
			ByteArrayOutputStream stream = new ByteArrayOutputStream();
			Bitmap bitmap = BitmapFactory.decodeResource(PdfTestRunner.getActivity().getResources(), R.drawable.otsoe);
			bitmap.compress(Bitmap.CompressFormat.JPEG /* FileType */,
			                        100 /* Ratio */, stream);
			Image im = Image.getInstance(stream.toByteArray());
			im.setRotationDegrees(30);
			PdfPTable table = new PdfPTable(4);
			table.addCell("text 1");
			PdfPCell cell = new PdfPCell(im, true);
			cell.setCellEvent(event);
			table.addCell(cell);
			table.addCell("text 3");
			im.setRotationDegrees(0);
			table.addCell(im);
			table.setTotalWidth(300);
			PdfContentByte cb = writer.getDirectContent();
			table.writeSelectedRows(0, -1, 50, 600, cb);
			table.setHeaderRows(3);
			document.add(table);
		} catch (Exception de) {
			de.printStackTrace();
		}
		// step5
		document.close();
	}
 
开发者ID:fc-dream,项目名称:PDFTestForAndroid,代码行数:46,代码来源:CellEvents.java

示例14: main

import com.lowagie.text.pdf.PdfPTable; //导入方法依赖的package包/类
/**
 * Break a large table up into several smaller tables for memory management
 * purposes.
 * 
 * @param args
 *            the number of rows for each table fragment.
 */
public static void main(String[] args) {

	System.out.println("Split Table");
	// step1
	Document document = new Document(PageSize.A4, 10, 10, 10, 10);
	try {
		// step2
		PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(android.os.Environment.getExternalStorageDirectory() + java.io.File.separator + "droidtext" + java.io.File.separator + "SplitTable.pdf"));
		// step3
		document.open();
		// step4

		PdfContentByte cb = writer.getDirectContent();
		PdfPTable table = new PdfPTable(10);
		for (int k = 1; k <= 100; ++k) {
			table.addCell("The number " + k);
		}
		table.setTotalWidth(800);
		table.writeSelectedRows(0, 5, 0, -1, 50, 650, cb);
		document.newPage();
		table.writeSelectedRows(5, -1, 0, -1, 50, 650, cb);
		document.close();
	} catch (Exception de) {
		de.printStackTrace();
	}
	// step5
	document.close();
}
 
开发者ID:fc-dream,项目名称:PDFTestForAndroid,代码行数:36,代码来源:SplitTable.java

示例15: onEndPage

import com.lowagie.text.pdf.PdfPTable; //导入方法依赖的package包/类
@Override
public void onEndPage(PdfWriter writer, Document document) {
    try {
        Rectangle page = document.getPageSize();
        PdfPTable footer = new PdfPTable(1);
        footer.setWidthPercentage(100);
        footer.setSpacingBefore(20);
        PdfPCell footerPageNocell = new PdfPCell(new Paragraph(messageSource.getMessage("hrms.payroll.computer.generated.payslip.not.require.signature", null, RequestContextUtils.getLocale(request)), fontMediumRegular));
        footerPageNocell.setBorder(0);
        footerPageNocell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        footer.addCell(footerPageNocell);
        footer.setTotalWidth(page.getWidth() - document.leftMargin() - document.rightMargin());
        footer.writeSelectedRows(0, -1, document.leftMargin(), document.bottomMargin()+2 , writer.getDirectContent());

    } catch (Exception e) {
        throw new ExceptionConverter(e);
    }
}
 
开发者ID:mobilipia,项目名称:Deskera-HRMS,代码行数:19,代码来源:ExportLeavePdfServlet.java


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