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


Java Table.setWidth方法代码示例

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


在下文中一共展示了Table.setWidth方法的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: 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

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

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

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

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

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

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

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

示例10: createTable

import com.lowagie.text.Table; //导入方法依赖的package包/类
/**
 * creates a Table for reports
 * 
 * @param nbOfColumns
 *            the number of columns for the table
 * @param padding
 *            the space padding for the table
 * @param spacing
 *            the spacing for the table
 * @param width
 *            the width of the table
 * 
 * @return Table the table ready to use
 * 
 */
public static Table createTable(int nbOfColumns, int padding, int spacing, int width) {

    try {

        Table table = new Table(nbOfColumns);
        table.setBorderWidth(0f);
        table.setPadding(padding);
        table.setSpacing(spacing);
        table.setWidth(width);

        return table;

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

        return null;
    }

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

示例11: main

import com.lowagie.text.Table; //导入方法依赖的package包/类
/**
 * Extended headers / footers example
 * 
 * 
 */
@Test
public void main() throws Exception {
	Document document = new Document();
	RtfWriter2.getInstance(document, PdfTestBase.getOutputStream("ExtendedHeaderFooter.rtf"));

	// Create the Paragraphs that will be used in the header.
	Paragraph date = new Paragraph("01.01.2010");
	date.setAlignment(Paragraph.ALIGN_RIGHT);
	Paragraph address = new Paragraph("TheFirm\nTheRoad 24, TheCity\n" + "+00 99 11 22 33 44");

	// Create the RtfHeaderFooter with an array containing the Paragraphs to
	// add
	RtfHeaderFooter header = new RtfHeaderFooter(new Element[] { date, address });

	// Set the header
	document.setHeader(header);

	// Create the table that will be used as the footer
	Table footer = new Table(2);
	footer.setBorder(0);
	footer.getDefaultCell().setBorder(0);
	footer.setWidth(100);
	footer.addCell(new Cell("(c) Mark Hall"));
	Paragraph pageNumber = new Paragraph("Page ");

	// The RtfPageNumber is an RTF specific element that adds a page number
	// field
	pageNumber.add(new RtfPageNumber());
	pageNumber.setAlignment(Paragraph.ALIGN_RIGHT);
	footer.addCell(new Cell(pageNumber));

	// Create the RtfHeaderFooter and set it as the footer to use
	document.setFooter(new RtfHeaderFooter(footer));

	document.open();

	document.add(new Paragraph("This document has headers and footers created"
			+ " using the RtfHeaderFooter class."));

	document.close();

}
 
开发者ID:albfernandez,项目名称:itext2,代码行数:48,代码来源:ExtendedHeaderFooterTest.java

示例12: getFooter

import com.lowagie.text.Table; //导入方法依赖的package包/类
/**
 * This message creates the footer element for the exported document.
 *
 * @param queryInstance
 *            The query instance to extract needed data from.
 * @param user
 *            The user.
 * @param resourcesManager
 *            The resources manager to retreive resources from.
 * @return An object to be used as a header.
 * @throws MalformedURLException
 *             {@link MalformedURLException}.
 * @throws BadElementException
 *             {@link BadElementException}.
 */
private Element getFooter(NoteQueryParameters queryInstance, User user,
        ResourceBundleManager resourcesManager) throws MalformedURLException,
        BadElementException {
    Table table = new Table(2);
    table.setWidths(new float[] { 60, 40 });
    table.setWidth(100);
    table.setPadding(5);
    table.setBorder(Table.TOP);
    Cell serviceCell = new Cell();
    serviceCell.setBorder(Cell.TOP);
    serviceCell.add(RtfElementFactory.createChunk(
            resourcesManager.getText("export.post.footer.service", user.getLanguageLocale())
            + " ", null));
    serviceCell.add(RtfElementFactory.createChunk(resourcesManager.getText(
            "export.post.footer.service.provider", user.getLanguageLocale())));
    Cell pageNumberCell = new Cell();
    pageNumberCell.setHorizontalAlignment(Cell.ALIGN_RIGHT);
    pageNumberCell.setBorder(Cell.TOP);
    pageNumberCell.add(RtfElementFactory.createChunk(resourcesManager.getText(
            "export.post.footer.page", user.getLanguageLocale()) + " "));
    pageNumberCell.add(new RtfPageNumber());
    pageNumberCell
    .add(RtfElementFactory.createChunk(" "
            + resourcesManager.getText("export.post.footer.of",
                    user.getLanguageLocale()) + " "));
    pageNumberCell.add(new RtfTotalPageNumber());

    table.addCell(serviceCell);
    table.addCell(pageNumberCell);
    return table;
}
 
开发者ID:Communote,项目名称:communote-server,代码行数:47,代码来源:RtfNoteWriter.java

示例13: renderHeaders

import com.lowagie.text.Table; //导入方法依赖的package包/类
/**
 * Effectue le rendu des headers.
 *
 * @param table
 *           MBasicTable
 * @param datatable
 *           Table
 * @throws BadElementException
 *            e
 */
protected void renderHeaders(final MBasicTable table, final Table datatable)
		throws BadElementException {
	final int columnCount = table.getColumnCount();
	final TableColumnModel columnModel = table.getColumnModel();
	// size of columns
	float totalWidth = 0;
	for (int i = 0; i < columnCount; i++) {
		totalWidth += columnModel.getColumn(i).getWidth();
	}
	final float[] headerwidths = new float[columnCount];
	for (int i = 0; i < columnCount; i++) {
		headerwidths[i] = 100f * columnModel.getColumn(i).getWidth() / totalWidth;
	}
	datatable.setWidths(headerwidths);
	datatable.setWidth(100f);

	// table header
	final Font font = FontFactory.getFont(FontFactory.HELVETICA, 12, Font.BOLD);
	datatable.getDefaultCell().setBorderWidth(2);
	datatable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
	// datatable.setDefaultCellGrayFill(0.75f);

	String text;
	Object value;
	for (int i = 0; i < columnCount; i++) {
		value = columnModel.getColumn(i).getHeaderValue();
		text = value != null ? value.toString() : "";
		datatable.addCell(new Phrase(text, font));
	}
	// end of the table header
	datatable.endHeaders();
}
 
开发者ID:javamelody,项目名称:javamelody,代码行数:43,代码来源:MPdfWriter.java

示例14: 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 items the items in the group
 * @throws DocumentException for any errors encountered
 */
private void renderGroup(Document document, GroupingKey groupingKey,
    List<MonthlyAdjustmentReportResponseItem> items) throws DocumentException {

    Table table = new Table(2);
    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[] {10, 90});

    String groupLabel = "{0}  {1} changed account #{2}";
    String groupHeader = MessageFormat.format(groupLabel, groupingKey.date, groupingKey.user,
        groupingKey.claimNumber);
    Cell headerCell = new Cell(new Phrase(groupHeader, ReportHelper.TABLE_HEADER_FONT));
    headerCell.setColspan(2);
    headerCell.setBorder(Cell.BOTTOM);
    table.addCell(headerCell);
    for (MonthlyAdjustmentReportResponseItem row : items) {
        table.addCell(new Phrase(ReportHelper.formatDate(row.getDate(), "hh:mm a"), ReportHelper.TABLE_DATA_FONT));
        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,代码行数:37,代码来源:MonthlyAdjustmentReportService.java

示例15: renderAccountHolder

import com.lowagie.text.Table; //导入方法依赖的package包/类
/**
 * Renders account holder.
 * @param response the response object.
 * @param document the document
 * @throws DocumentException may be thrown by the iText library while rendering the elements
 */
private void renderAccountHolder(PaymentHistoryReportResponse response, Document document)
    throws DocumentException {
    Table table = new Table(2);
    table.setBorder(Table.NO_BORDER);
    Cell cell = new Cell();
    cell.setBorder(Cell.NO_BORDER);
    table.setDefaultCell(cell);
    table.setWidth(80);
    table.setPadding(0);

    // table header and column widths
    table.setWidths(new float[] {80, 20});

    table.addCell(new Phrase(response.getUsername(), ReportHelper.TABLE_HEADER_FONT));
    table.addCell(new Phrase("CSD#" + response.getCsd(), ReportHelper.TABLE_DATA_FONT));

    table.addCell(new Phrase(response.getAddress1(), ReportHelper.TABLE_DATA_FONT));
    table.addCell(new Phrase("", ReportHelper.TABLE_DATA_FONT));
    if (response.getAddress2() != null) {
        table.addCell(new Phrase(response.getAddress2(), ReportHelper.TABLE_DATA_FONT));
        table.addCell(new Phrase("", ReportHelper.TABLE_DATA_FONT));
    }
    table.addCell(new Phrase(formatStateLine(response), ReportHelper.TABLE_DATA_FONT));
    document.add(table);
    document.add(new Paragraph(" "));
}
 
开发者ID:NASA-Tournament-Lab,项目名称:CoECI-OPM-Service-Credit-Redeposit-Deposit-Application,代码行数:33,代码来源:PaymentHistoryReportService.java


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