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


Java PdfPTable.addCell方法代码示例

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


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

示例1: write

import com.lowagie.text.pdf.PdfPTable; //导入方法依赖的package包/类
public void write(PDFDocument document, PdfPTable tabla) throws DocumentException {
	com.lowagie.text.List list = new com.lowagie.text.List(false,10f);
	list.setListSymbol(new Chunk("\u2022"));

	PdfPCell cell = new PdfPCell();
	
	if(!titulo.equals(""))
	{
	   cell.addElement(new Phrase(titulo,document.getContext().getDefaultFont()));
	}

	for(int i=0; i<campos.size(); i++)
	{
		list.add(new ListItem((String)campos.get(i),document.getContext().getDefaultFont()));
	}
	
	cell.addElement(list);
	cell.setPaddingLeft(30f);
	cell.setBorder(Rectangle.LEFT | Rectangle.RIGHT);
	cell.setColspan(2);
	tabla.addCell(cell);
	
}
 
开发者ID:GovernIB,项目名称:sistra,代码行数:24,代码来源:Lista.java

示例2: insertTable_TextRow

import com.lowagie.text.pdf.PdfPTable; //导入方法依赖的package包/类
private void insertTable_TextRow( PdfWriter writer, PdfPTable mainTable, String text, Font font )
{
    boolean hasBorder = false;

    // Add Organization ID/Period textfield
    // Create A table to add for each group AT HERE
    PdfPTable table = new PdfPTable( 1 );
    table.setHorizontalAlignment( Element.ALIGN_LEFT );

    addCell_Text( table, PdfDataEntryFormUtil.getPdfPCell( hasBorder ), text, Element.ALIGN_LEFT, font );

    // Add to the main table
    PdfPCell cell_withInnerTable = new PdfPCell( table );

    cell_withInnerTable.setBorder( Rectangle.NO_BORDER );

    mainTable.addCell( cell_withInnerTable );
}
 
开发者ID:ehatle,项目名称:AgileAlligators,代码行数:19,代码来源:DefaultPdfDataEntryFormService.java

示例3: 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

示例4: buildPdfDocument

import com.lowagie.text.pdf.PdfPTable; //导入方法依赖的package包/类
@Override
protected void buildPdfDocument(Map<String, Object> model, Document document, PdfWriter writer,
		HttpServletRequest request, HttpServletResponse response) throws Exception {

	List<Book> books = (List<Book>) model.get("book");

	PdfPTable table = new PdfPTable(3);
	table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
	table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
	table.getDefaultCell().setBackgroundColor(Color.lightGray);

	table.addCell("Book Name");
	table.addCell("Author Name");
	table.addCell("Price");

	for (Book book : books) {
		table.addCell(book.getBookName());
		table.addCell(book.getAuthor());
		table.addCell("" + book.getPrice());
	}
	document.add(table);

}
 
开发者ID:PacktPublishing,项目名称:Learning-Spring-5.0,代码行数:24,代码来源:PdfView.java

示例5: createNeedHeader

import com.lowagie.text.pdf.PdfPTable; //导入方法依赖的package包/类
private PdfPTable createNeedHeader(String name) throws DocumentException {
	Font whiteFont = new Font(Font.HELVETICA,14,Font.BOLD,Color.WHITE);
	PdfPTable table = new PdfPTable(3);
	table.setWidthPercentage(100);
	table.setWidths(new float[]{0.10f,0.20f,0.70f});
	PdfPCell emptyCell = new PdfPCell();
	emptyCell.setBorder(0);
	table.addCell(emptyCell);

	PdfPCell headerCell = new PdfPCell();
	headerCell.setColspan(2);
	headerCell.setPhrase(new Phrase(name,whiteFont));
	headerCell.setHorizontalAlignment(Element.ALIGN_CENTER);
	headerCell.setBackgroundColor(Color.LIGHT_GRAY);
	table.addCell(headerCell);
	return table;
}
 
开发者ID:williamgrosset,项目名称:OSCAR-ConCert,代码行数:18,代码来源:SummaryOfActionsAndCommentsReportGenerator.java

示例6: writeCampos

import com.lowagie.text.pdf.PdfPTable; //导入方法依赖的package包/类
private void writeCampos(PDFDocument document, PdfPTable tb)
{
	PdfPTable tabla = new PdfPTable(anchoColumnas);
	PdfPCell cell;
	tabla.setWidthPercentage(100);
	Font font = document.getContext().getDefaultFont();
	for(int i=0; i<campos.size();i++)
	{
		cell = createCell("",Rectangle.LEFT | Rectangle.RIGHT);
		tabla.addCell(cell);
		Vector cp = (Vector)campos.get(i);
		for(int j=0; j<cp.size(); j++)
		{
			cell = createCell((String)cp.get(j),font);
			tabla.addCell(cell);
		}
		cell = createCell("",Rectangle.LEFT | Rectangle.RIGHT);
		tabla.addCell(cell);
	}
	addTabla(tb,tabla);
}
 
开发者ID:GovernIB,项目名称:sistra,代码行数:22,代码来源:Tabla.java

示例7: writeGraph

import com.lowagie.text.pdf.PdfPTable; //导入方法依赖的package包/类
private void writeGraph() throws IOException, DocumentException {
	final JRobin jrobin = collector.getJRobin(graphName);
	if (jrobin != null) {
		final byte[] img = jrobin.graph(range, 960, 400);
		final Image image = Image.getInstance(img);
		image.scalePercent(50);

		final PdfPTable table = new PdfPTable(1);
		table.setHorizontalAlignment(Element.ALIGN_CENTER);
		table.setWidthPercentage(100);
		table.getDefaultCell().setBorder(0);
		table.addCell("\n");
		table.addCell(image);
		table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT);
		table.addCell(new Phrase(getString("graph_units"), cellFont));
		addToDocument(table);
	} else {
		// just in case request is null and collector.getJRobin(graphName) is null, we must write something in the document
		addToDocument(new Phrase("\n", cellFont));
	}
}
 
开发者ID:javamelody,项目名称:javamelody,代码行数:22,代码来源:PdfRequestAndGraphDetailReport.java

示例8: insertTable_HiddenValue

import com.lowagie.text.pdf.PdfPTable; //导入方法依赖的package包/类
private void insertTable_HiddenValue( PdfPTable mainTable, Rectangle rectangle, PdfWriter writer, String fieldName,
    String value )
    throws IOException, DocumentException
{
    boolean hasBorder = false;

    // Add Organization ID/Period textfield
    // Create A table to add for each group AT HERE
    PdfPTable table = new PdfPTable( 1 ); // Code 1

    addCell_WithTextField( table, rectangle, writer, PdfDataEntryFormUtil.getPdfPCell( hasBorder ), fieldName, value );

    // Add to the main table
    PdfPCell cell_withInnerTable = new PdfPCell( table );
    // cell_withInnerTable.setPadding(0);
    cell_withInnerTable.setBorder( Rectangle.NO_BORDER );
    mainTable.addCell( cell_withInnerTable );
}
 
开发者ID:ehatle,项目名称:AgileAlligators,代码行数:19,代码来源:DefaultPdfDataEntryFormService.java

示例9: addCell_WithTextField

import com.lowagie.text.pdf.PdfPTable; //导入方法依赖的package包/类
private void addCell_WithTextField( PdfPTable table, Rectangle rect, PdfWriter writer, PdfPCell cell, String strfldName,
    int fieldCellType, String value )
    throws IOException, DocumentException
{
    TextField nameField = new TextField( writer, rect, strfldName );

    nameField.setBorderWidth( 1 );
    nameField.setBorderColor( Color.BLACK );
    nameField.setBorderStyle( PdfBorderDictionary.STYLE_SOLID );
    nameField.setBackgroundColor( COLOR_BACKGROUDTEXTBOX );

    nameField.setText( value );

    nameField.setAlignment( Element.ALIGN_RIGHT );
    nameField.setFont( pdfFormFontSettings.getFont( PdfFormFontSettings.FONTTYPE_BODY ).getBaseFont() );

    cell.setCellEvent( new PdfFieldCell( nameField.getTextField(), rect.getWidth(), rect.getHeight(), fieldCellType, writer ) );

    table.addCell( cell );
}
 
开发者ID:ehatle,项目名称:AgileAlligators,代码行数:21,代码来源:DefaultPdfDataEntryFormService.java

示例10: addCell_WithDropDownListField

import com.lowagie.text.pdf.PdfPTable; //导入方法依赖的package包/类
private void addCell_WithDropDownListField( PdfPTable table, Rectangle rect, PdfWriter writer, PdfPCell cell, String strfldName, String[] optionList,
    String[] valueList ) throws IOException, DocumentException
{
    TextField textList = new TextField( writer, rect, strfldName );

    textList.setChoices( optionList );
    textList.setChoiceExports( valueList );

    textList.setBorderWidth( 1 );
    textList.setBorderColor( Color.BLACK );
    textList.setBorderStyle( PdfBorderDictionary.STYLE_SOLID );
    textList.setBackgroundColor( COLOR_BACKGROUDTEXTBOX );

    PdfFormField dropDown = textList.getComboField();

    cell.setCellEvent( new PdfFieldCell( dropDown, rect.getWidth(), rect.getHeight(), writer ) );

    table.addCell( cell );
}
 
开发者ID:ehatle,项目名称:AgileAlligators,代码行数:20,代码来源:DefaultPdfDataEntryFormService.java

示例11: addResultExample

import com.lowagie.text.pdf.PdfPTable; //导入方法依赖的package包/类
private void addResultExample(Section section, ApiDoc apiDoc) throws Exception {
		
	      Paragraph result = new Paragraph(itemFont.process("★返回示例"));
//	      result.setLeading(6f);
	      result.setSpacingBefore(6f);
	      result.setSpacingAfter(8f);
	      
	      PdfPTable table = new PdfPTable(1);
	      table.setWidthPercentage(95f);
	      table.setHorizontalAlignment(Element.ALIGN_LEFT);
	      PdfPCell pdfPCell = table.getDefaultCell();
	      pdfPCell.setHorizontalAlignment(Element.ALIGN_LEFT);
	      pdfPCell.setBackgroundColor(Color.LIGHT_GRAY);
	      if (apiDoc.getResultDoc() != null && apiDoc.getResultExample() != null) {
	    	  pdfPCell.setPhrase(DefaultPdfTable.tableBSelector.process(apiDoc.getResultExample()));
	      }
	      table.addCell(pdfPCell);
	      Paragraph wrapperTable = new Paragraph();
	      wrapperTable.setSpacingAfter(8f);
	      wrapperTable.setIndentationLeft(12f);
	      wrapperTable.add(table);
	      section.add(result);
	      section.add(wrapperTable);
	}
 
开发者ID:linkeer8802,项目名称:api-resolver,代码行数:25,代码来源:SimplePdfDocInstaller.java

示例12: 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

示例13: addComponyLogo

import com.lowagie.text.pdf.PdfPTable; //导入方法依赖的package包/类
private static void addComponyLogo(Document d, HttpServletRequest req) throws ConfigurationException, DocumentException {
    PdfPTable table = new PdfPTable(1);
    imgPath = StorageHandler.GetProfileImgStorePath() + "logo.gif";
    table.setHorizontalAlignment(Element.ALIGN_LEFT);
    table.setWidthPercentage(50);
    PdfPCell cell = null;
    try {
        if(StringUtil.isStandAlone()){
            imgPath = URLUtil.getPageURL(req, "").concat(defaultCompanyImgPath);
        }
        Image img = Image.getInstance(imgPath);
        cell = new PdfPCell(img);
    } catch (Exception e) {
        cell = new PdfPCell(new Paragraph(companyName, fontBig));
    }
    cell.setBorder(0);
    cell.setHorizontalAlignment(Element.ALIGN_LEFT);
    table.addCell(cell);
    d.add(table);
}
 
开发者ID:mobilipia,项目名称:Deskera-HRMS,代码行数:21,代码来源:ExportServlet.java

示例14: buildTable

import com.lowagie.text.pdf.PdfPTable; //导入方法依赖的package包/类
public PdfPTable buildTable() {
    if (rows.isEmpty())
        return new PdfPTable(1);
    int ncol = 0;
    ArrayList c0 = (ArrayList)rows.get(0);
    for (int k = 0; k < c0.size(); ++k) {
        ncol += ((PdfPCell)c0.get(k)).getColspan();
    }
    PdfPTable table = new PdfPTable(ncol);
    String width = (String)props.get("width");
    if (width == null)
        table.setWidthPercentage(100);
    else {
        if (width.endsWith("%"))
            table.setWidthPercentage(Float.parseFloat(width.substring(0, width.length() - 1)));
        else {
            table.setTotalWidth(Float.parseFloat(width));
            table.setLockedWidth(true);
        }
    }
    for (int row = 0; row < rows.size(); ++row) {
        ArrayList col = (ArrayList)rows.get(row);
        for (int k = 0; k < col.size(); ++k) {
            table.addCell((PdfPCell)col.get(k));
        }
    }
    return table;
}
 
开发者ID:albfernandez,项目名称:itext2,代码行数:29,代码来源:IncTable.java

示例15: addCell_WithRadioButton

import com.lowagie.text.pdf.PdfPTable; //导入方法依赖的package包/类
@SuppressWarnings( "unused" )
private void addCell_WithRadioButton( PdfPTable table, PdfWriter writer, PdfPCell cell, String strfldName )
{
    PdfFormField radiogroupField = PdfFormField.createRadioButton( writer, true );
    radiogroupField.setFieldName( strfldName );

    cell.setCellEvent( new PdfFieldCell( radiogroupField, new String[]{ "Yes", "No", "null" }, new String[]{
        "true", "false", "" }, "", 30.0f, PdfDataEntryFormUtil.UNITSIZE_DEFAULT, PdfFieldCell.TYPE_RADIOBUTTON, writer ) );

    table.addCell( cell );

    writer.addAnnotation( radiogroupField );
}
 
开发者ID:dhis2,项目名称:dhis2-core,代码行数:14,代码来源:DefaultPdfDataEntryFormService.java


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