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


Java Table类代码示例

本文整理汇总了Java中com.lowagie.text.Table的典型用法代码示例。如果您正苦于以下问题:Java Table类的具体用法?Java Table怎么用?Java Table使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getPersonalInfo

import com.lowagie.text.Table; //导入依赖的package包/类
/**
 * Get the PDF Table with personal information about the initiator and traveler
 *
 * @returns {@link Table} used for a PDF
 */
protected Table getPersonalInfo() throws BadElementException {
    final Table retval = new Table(2);
    retval.setWidth(100f);
    retval.setBorder(NO_BORDER);
    retval.addCell(getHeaderCell("Traveler"));

    final Cell initiatorHeaderCell = getHeaderCell("Request Submitted By");

    retval.addCell(initiatorHeaderCell);
    retval.endHeaders();
    retval.addCell(getTravelerInfo());

    final Cell initiatorCell = getInitiatorInfo();

    retval.addCell(initiatorCell);
    return retval;
}
 
开发者ID:kuali,项目名称:kfs,代码行数:23,代码来源:Coversheet.java

示例2: createHeader1

import com.lowagie.text.Table; //导入依赖的package包/类
/**
 * creates the diagram figure header
 * 
 * @param document
 *            the document we are reporting into
 * @param string
 *            the string to show in the figure header
 */
public void createHeader1(Document document, String string) {
    try {

        Table headerTable = ReportUtils.createTable(2, 2, 0, 100);

        Chunk name = new Chunk(string, header1Font);
        Cell nameCell = new Cell(name);
        nameCell.setColspan(2);
        nameCell.setBorderWidthBottom(1.5f);

        headerTable.addCell(nameCell);
        document.add(headerTable);

    } catch (Exception e) {
        jUCMNavErrorDialog error = new jUCMNavErrorDialog(e.getMessage());
        e.printStackTrace();

    }
}
 
开发者ID:McGill-DP-Group,项目名称:seg.jUCMNav,代码行数:28,代码来源:PDFReportDiagram.java

示例3: PdfTable

import com.lowagie.text.Table; //导入依赖的package包/类
/**
 * Constructs a <CODE>PdfTable</CODE>-object.
 *
 * @param	table	a <CODE>Table</CODE>
 * @param	left	the left border on the page
 * @param	right	the right border on the page
 * @param	top		the start position of the top of the table
 * @since	a parameter of this method has been removed in iText 2.0.8
 */
   
PdfTable(Table table, float left, float right, float top) {
	// constructs a Rectangle (the bottom value will be changed afterwards)
	super(left, top, right, top);
	this.table = table;
       table.complete();
       
	// copying the attributes from class Table
       cloneNonPositionParameters(table);

	this.columns = table.getColumns();
	positions = table.getWidths(left, right - left);
       
	// initialization of some parameters
	setLeft(positions[0]);
	setRight(positions[positions.length - 1]);
	
	headercells = new ArrayList();
	cells = new ArrayList();

	updateRowAdditionsInternal();
}
 
开发者ID:albfernandez,项目名称:itext2,代码行数:32,代码来源:PdfTable.java

示例4: createWord

import com.lowagie.text.Table; //导入依赖的package包/类
public void createWord() {
	DruidDataSource dataSource = new DruidDataSource();
	dataSource.setDriverClassName("com.mysql.jdbc.Driver");
	dataSource.setUrl("jdbc:mysql://localhost:3306/xiu?useUnicode=true&characterEncoding=UTF-8");
	dataSource.setUsername("root");
	dataSource.setPassword("");

	Platform platform = PlatformFactory.createNewPlatformInstance(dataSource);
	Database model = platform.readModelFromDatabase("xiu");
	System.out.println(model.toVerboseString());
	System.out.println(Boon.toPrettyJson(model));

	org.apache.ddlutils.model.Table dbTable = model.findTable("t_user");
	ForeignKey[] fks = dbTable.getForeignKeys();
	for (ForeignKey fk : fks) {
		System.out.println(fk.getName());
		System.out.println(fk.getFirstReference().getLocalColumnName());
		System.out.println(fk.getForeignTableName());
		System.out.println(fk.getFirstReference().getForeignColumnName());
	}

	toWord(model);
}
 
开发者ID:East196,项目名称:maker,代码行数:24,代码来源:Itext2Word.java

示例5: initTable

import com.lowagie.text.Table; //导入依赖的package包/类
/**
 * Initialize the main info holder table.
 * 
 * @throws BadElementException
 *             for errors during table initialization
 */
protected void initTable() throws BadElementException {
	tablePDF = new Table(this.model.getNumberOfColumns());
	tablePDF.setDefaultVerticalAlignment(Element.ALIGN_TOP);
	tablePDF.setCellsFitPage(true);
	tablePDF.setWidth(100);

	tablePDF.setPadding(2);
	tablePDF.setSpacing(0);

	// smallFont = FontFactory.getFont(FontFactory.HELVETICA, 7,
	// Font.NORMAL, new Color(0, 0, 0));
	smallFont = FontFactory.getFont("STSong-Light", "UniGB-UCS2-H", Font.DEFAULTSIZE);
}
 
开发者ID:8090boy,项目名称:gomall.la,代码行数:20,代码来源:SimpleChinesePdfView.java

示例6: getTripInfo

import com.lowagie.text.Table; //导入依赖的package包/类
/**
 * Get the PDF Table containing trip information like trip id, date, and destination
 *
 * @returns {@link Table} used for a PDF
 */
protected Table getTripInfo() throws BadElementException {
    final Table retval = new Table(3);
    retval.setWidth(100f);
    retval.setBorder(NO_BORDER);
    retval.addCell(getHeaderCell("Trip/Event ID"));

    final Cell dateHeaderCell = getHeaderCell("Date");

    retval.addCell(dateHeaderCell);
    retval.addCell(getHeaderCell("Destination/Event Name"));
    retval.endHeaders();
    retval.addCell(getBorderlessCell(getTripId()));

    final Cell dateCell = getBorderlessCell(getDate());

    retval.addCell(dateCell);
    retval.addCell(getBorderlessCell(getDestination()));
    return retval;
}
 
开发者ID:kuali,项目名称:kfs,代码行数:25,代码来源:Coversheet.java

示例7: getExpenses

import com.lowagie.text.Table; //导入依赖的package包/类
public Table getExpenses() throws BadElementException {
    final Table retval = new Table(3);
    retval.setWidth(100f);
    retval.setBorder(NO_BORDER);
    retval.addCell(getHeaderCell("Expenses"));
    retval.addCell(getHeaderCell("Amount"));
    retval.addCell(getHeaderCell("Receipt Required?"));
    retval.endHeaders();

    for (final Map<String, String> expense : expenses) {
        retval.addCell(getBorderlessCell(expense.get("expenseType")));
        retval.addCell(getBorderlessCell(expense.get("amount")));
        retval.addCell(getBorderlessCell(expense.get("receipt")));
    }
    return retval;
}
 
开发者ID:kuali,项目名称:kfs,代码行数:17,代码来源:Coversheet.java

示例8: generateHeaders

import com.lowagie.text.Table; //导入依赖的package包/类
/**
 * Generates the header cells, which persist on every page of the PDF document.
 * 
 * @throws BadElementException
 *             IText exception
 * @throws NetxiliaBusinessException
 * @throws NetxiliaResourceException
 */
protected void generateHeaders(ISheet sheet, Table tablePDF, Font font, int columnCount)
		throws BadElementException, NetxiliaResourceException, NetxiliaBusinessException {

	Cell hdrCell = getCell("", font, Element.ALIGN_CENTER, 50);
	hdrCell.setGrayFill(0.9f);
	hdrCell.setHeader(true);
	tablePDF.addCell(hdrCell);

	List<ColumnData> columnData = sheet.receiveColumns(Range.ALL).getNonBlocking();

	for (int i = 0; i < columnCount; ++i) {
		ColumnData column = i < columnData.size() ? columnData.get(i) : null;
		hdrCell = getCell(CellReference.columnLabel(i), font, Element.ALIGN_CENTER, column != null ? column
				.getWidth() : 120);
		hdrCell.setGrayFill(0.9f);
		hdrCell.setHeader(true);
		tablePDF.addCell(hdrCell);

	}
}
 
开发者ID:netxilia,项目名称:netxilia,代码行数:29,代码来源:SheetPdfProvider.java

示例9: renderItems

import com.lowagie.text.Table; //导入依赖的package包/类
/**
 * Renders the contents of the report.
 *
 * @param response the report data
 * @param document the current report document
 * @throws DocumentException for any other errors encountered
 */
private void renderItems(ChangeHistoryReportResponse response, Document document) throws DocumentException {
    // generate header table
    Table table = new Table(3);
    table.setBorder(Table.TOP | Table.BOTTOM | Table.LEFT | Table.RIGHT);
    Cell cell = new Cell();
    cell.setBorder(Cell.LEFT);
    table.setDefaultCell(cell);
    table.setWidth(100);
    table.setPadding(1);

    table.addCell(new Phrase("CSD #" + response.getCsd(), ReportHelper.TABLE_HEADER_FONT));
    table.addCell(new Phrase(ReportHelper.formatDate(response.getBirthDay()), ReportHelper.TABLE_HEADER_FONT));
    table.addCell(new Phrase(response.getClaimName(), ReportHelper.TABLE_HEADER_FONT));
    document.add(table);

    Map<GroupingKey, List<ChangeHistoryReportResponseItem>> groups = groupItems(response);
    Set<GroupingKey> keySet = groups.keySet();
    for (GroupingKey groupingKey : keySet) {
        renderGroup(document, groupingKey, groups.get(groupingKey));
    }

    if (response.getItems().isEmpty()) {
        document.add(new Paragraph("There are no changes on record.", ReportHelper.TABLE_DATA_FONT));
    }
}
 
开发者ID:NASA-Tournament-Lab,项目名称:CoECI-OPM-Service-Credit-Redeposit-Deposit-Application,代码行数:33,代码来源:ChangeHistoryReportService.java

示例10: renderGroup

import com.lowagie.text.Table; //导入依赖的package包/类
/**
 * Renders all the records that are part of a group.
 *
 * @param document the current report
 * @param groupingKey the grouping key
 * @param list the items in the group
 * @throws DocumentException for any errors encountered
 */
private void renderGroup(Document document, GroupingKey groupingKey, List<ChangeHistoryReportResponseItem> list)
    throws DocumentException {
    Table table = new Table(1);
    table.setBorder(Table.NO_BORDER);
    Cell cell = new Cell();
    cell.setBorder(Cell.NO_BORDER);
    table.setDefaultCell(cell);
    table.setWidth(100);
    table.setPadding(1);

    // table header and column widths
    table.setWidths(new float[] {100});
    String groupLabel = "{0}                               {1}";
    String groupHeader = MessageFormat.format(groupLabel, groupingKey.date, groupingKey.user);
    Cell headerCell = new Cell(new Phrase(groupHeader, ReportHelper.TABLE_HEADER_FONT));
    headerCell.setBorder(Cell.BOTTOM);
    table.addCell(headerCell);
    for (ChangeHistoryReportResponseItem row : list) {
        table.addCell(new Phrase(row.getDescription(), ReportHelper.TABLE_DATA_FONT));
    }
    document.add(table);
    document.add(new Phrase(" ")); // spacer
}
 
开发者ID:NASA-Tournament-Lab,项目名称:CoECI-OPM-Service-Credit-Redeposit-Deposit-Application,代码行数:32,代码来源:ChangeHistoryReportService.java

示例11: renderSummary

import com.lowagie.text.Table; //导入依赖的package包/类
/**
 * Renders the summary of adjustments.
 *
 * @param document the current document
 * @param userChangeCount the map representing the number of changes per user
 * @param userAccounts the map representing the number of accounts per user
 * @throws DocumentException for any errors encountered
 */
private void renderSummary(Document document, Map<String, Integer> userChangeCount,
    Map<String, Set<String>> userAccounts) throws DocumentException {
    Table table = new Table(1);
    table.setBorder(Table.TOP | Table.LEFT | Table.BOTTOM);
    Cell cell = new Cell();
    cell.setBorder(Cell.NO_BORDER);
    table.setDefaultCell(cell);
    table.setWidth(100);
    table.setPadding(1);
    // table header and column widths
    table.setWidths(new float[] {100});
    String groupLabel = "{0} made {1} changes to {2} accounts during this reporting period.";
    for (Map.Entry<String, Integer> user : userChangeCount.entrySet()) {
        Set<String> accountsModified = userAccounts.get(user.getKey());
        String userSummary = MessageFormat.format(groupLabel, user.getKey(), user.getValue(),
            accountsModified.size());
        table.addCell(new Phrase(userSummary, ReportHelper.TABLE_DATA_FONT));
    }
    document.add(table);
}
 
开发者ID:NASA-Tournament-Lab,项目名称:CoECI-OPM-Service-Credit-Redeposit-Deposit-Application,代码行数:29,代码来源:MonthlyAdjustmentReportService.java

示例12: renderGrandTotal

import com.lowagie.text.Table; //导入依赖的package包/类
/**
 * Renders the grand total.
 * @param response the response object
 * @param document the document report
 * @throws DocumentException may be thrown by the iText library while rendering the elements
 */
private void renderGrandTotal(PaymentPendingApprovalReportResponse response, Document document)
    throws DocumentException {
    Table table = new Table(2);
    table.setWidths(new float[]{80, 20});
    table.setBorder(Table.NO_BORDER);
    table.setWidth(40);
    table.setPadding(1);
    Cell cell = new Cell(new Phrase("Grand Total", ReportHelper.TABLE_HEADER_FONT));
    cell.setBorder(Cell.BOTTOM);
    cell.setBorderWidth(1f);
    table.addCell(cell);
    Cell subTotal = new Cell(new Phrase(response.getItems().size() + "", ReportHelper.TABLE_HEADER_FONT));
    subTotal.setBorder(Cell.BOTTOM);
    subTotal.setBorderWidth(1f);
    table.addCell(subTotal);
    document.add(table);
}
 
开发者ID:NASA-Tournament-Lab,项目名称:CoECI-OPM-Service-Credit-Redeposit-Deposit-Application,代码行数:24,代码来源:PaymentPendingApprovalReportService.java

示例13: renderGrouping

import com.lowagie.text.Table; //导入依赖的package包/类
/**
 * Render grouping.
 * @param response The response object
 * @param document The document report
 * @throws DocumentException may be thrown by the iText library while rendering the elements
 */
private void renderGrouping(PaymentPendingApprovalReportResponse response, Document document)
    throws DocumentException {
    Table table = new Table(2);
    table.setWidths(new float[]{80, 20});
    table.setBorder(Table.NO_BORDER);
    table.setWidth(40);
    table.setPadding(1);
    Cell cell = new Cell(new Phrase("Recievables Technician", ReportHelper.TABLE_HEADER_FONT));
    cell.setBorder(Cell.TOP | Cell.BOTTOM);
    table.addCell(cell);
    Cell subTotal = new Cell(new Phrase(response.getItems().size() + "", ReportHelper.TABLE_HEADER_FONT));
    subTotal.setBorder(Cell.TOP | Cell.BOTTOM);
    table.addCell(subTotal);
    document.add(table);
}
 
开发者ID:NASA-Tournament-Lab,项目名称:CoECI-OPM-Service-Credit-Redeposit-Deposit-Application,代码行数:22,代码来源:PaymentPendingApprovalReportService.java

示例14: addTotalRow

import com.lowagie.text.Table; //导入依赖的package包/类
/**
 * Adds a total row to the table.
 *
 * @param table
 *         the table.
 * @param contents
 *         the columns contents.
 * @param font
 *         the font to use.
 * @param borderTop
 *         the border top width.
 * @param borderBottom
 *         the border bottom width.
 */
private static void addTotalRow(Table table, Object[] contents, RtfFont font, int borderTop,
                                int borderBottom) {
    Cell labelCell = ReportServiceHelper.createTableCell(contents[0], font, null,
            ReportServiceHelper.RTF_ALIGN_RIGHT, null, 2);
    labelCell.setBorderWidthTop(borderTop);
    labelCell.setBorderWidthBottom(borderBottom);
    table.addCell(labelCell);

    Cell numberCell = ReportServiceHelper.createTableCell(contents[1], font, null,
            ReportServiceHelper.RTF_ALIGN_RIGHT, null, 1);
    numberCell.setBorderWidthTop(borderTop);
    numberCell.setBorderWidthBottom(borderBottom);
    table.addCell(numberCell);

    Cell totalCell = ReportServiceHelper.createTableCell(contents.length == 3 ? contents[2] : null, font, null,
            ReportServiceHelper.RTF_ALIGN_RIGHT, null, 1);
    totalCell.setBorderWidthTop(borderTop);
    totalCell.setBorderWidthBottom(borderBottom);
    table.addCell(totalCell);

    Cell emptyCell = ReportServiceHelper.createEmptyCell(1, null);
    emptyCell.setBorderWidthTop(borderTop);
    emptyCell.setBorderWidthBottom(borderBottom);
    table.addCell(emptyCell);
}
 
开发者ID:NASA-Tournament-Lab,项目名称:CoECI-OPM-Service-Credit-Redeposit-Deposit-Application,代码行数:40,代码来源:BalancedScorecardPaymentReportService.java

示例15: addContentRow

import com.lowagie.text.Table; //导入依赖的package包/类
/**
 * Adds a row for the field to the RTF table.
 *
 * @param table
 *         the table.
 * @param label
 *         the field label.
 * @param value
 *         the field value.
 * @param emptyCellColSpan
 *         how many columns the empty cell will span.
 */
private static void addContentRow(Table table, String label, String value,
                                  int emptyCellColSpan) {
    if (emptyCellColSpan > 0) {
        table.addCell(ReportServiceHelper.createEmptyCell(emptyCellColSpan,
                ReportServiceHelper.RTF_NO_BORDER));
    }

    table.addCell(ReportServiceHelper
            .createTableCell(
                    label,
                    emptyCellColSpan > 0 ? ReportServiceHelper.RTF_REPORT_CONTENT_FONT
                            : ReportServiceHelper.RTF_REPORT_HEADER_FONT,
                    null, ReportServiceHelper.RTF_ALIGN_LEFT,
                    ReportServiceHelper.RTF_BORDER_BOTTOM,
                    4 - emptyCellColSpan - 1));
    table.addCell(ReportServiceHelper
            .createTableCell(
                    value,
                    emptyCellColSpan > 0 ? ReportServiceHelper.RTF_REPORT_CONTENT_FONT
                            : ReportServiceHelper.RTF_REPORT_HEADER_FONT,
                    null, ReportServiceHelper.RTF_ALIGN_RIGHT,
                    ReportServiceHelper.RTF_BORDER_BOTTOM, 1));
}
 
开发者ID:NASA-Tournament-Lab,项目名称:CoECI-OPM-Service-Credit-Redeposit-Deposit-Application,代码行数:36,代码来源:AccountSummaryReportService.java


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