本文整理汇总了Java中com.lowagie.text.Table.setPadding方法的典型用法代码示例。如果您正苦于以下问题:Java Table.setPadding方法的具体用法?Java Table.setPadding怎么用?Java Table.setPadding使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.lowagie.text.Table
的用法示例。
在下文中一共展示了Table.setPadding方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: 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
示例3: 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
示例4: 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
示例5: 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
示例6: 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
示例7: 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;
}
}
示例8: setTableOptions
import com.lowagie.text.Table; //导入方法依赖的package包/类
private Table setTableOptions(Table table) {
table.setTableFitsPage(true);
table.setCellsFitPage(true);
table.setPadding(4);
return table;
}
示例9: 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;
}
示例10: initTable
import com.lowagie.text.Table; //导入方法依赖的package包/类
/**
* Initialize the main info holder table.
*
* @throws BadElementException
* for errors during table initialization
* @throws NetxiliaBusinessException
* @throws NetxiliaResourceException
*/
protected Table initTable(ISheet sheet) throws BadElementException, NetxiliaResourceException,
NetxiliaBusinessException {
Table tablePDF = new Table(sheet.getDimensions().getNonBlocking().getColumnCount() + 1);
// tablePDF.setDefaultVerticalAlignment(Element.ALIGN_TOP);
// tablePDF.setCellsFitPage(true);
// tablePDF.setWidth(100);
tablePDF.setPadding(2);
tablePDF.setSpacing(0);
return tablePDF;
}
示例11: renderSummaryTable
import com.lowagie.text.Table; //导入方法依赖的package包/类
/**
* Renders the summary table.
* @param grandTotal the report total
* @param response the report model
* @param document the current document
* @throws DocumentException may be thrown by the iText library while rendering the elements
*/
private void renderSummaryTable(ManualPaymentReportResponse response, Document document, BigDecimal grandTotal)
throws DocumentException {
// render grand total
// table styling
Table table = new Table(7);
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[] {17, 10, 10, 10, 12, 17, 24});
// label for the total
Cell summaryCell = new Cell(new Phrase("Grand Total:", ReportHelper.TABLE_HEADER_FONT));
summaryCell.setColspan(3);
summaryCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
table.addCell(summaryCell);
// group total value
Cell subTotalCell = ReportHelper.moneyCell(ReportHelper.formatMoney(grandTotal),
ReportHelper.TABLE_HEADER_FONT);
table.addCell(subTotalCell);
// complete the table with empty cells
Cell spacerCell = new Cell(new Phrase("in " + response.getItems().size() + " Payment(s)",
ReportHelper.TABLE_HEADER_FONT));
spacerCell.setColspan(3);
table.addCell(spacerCell);
document.add(table);
}
开发者ID:NASA-Tournament-Lab,项目名称:CoECI-OPM-Service-Credit-Redeposit-Deposit-Application,代码行数:41,代码来源:ManualPaymentReportService.java
示例12: 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
示例13: renderResults
import com.lowagie.text.Table; //导入方法依赖的package包/类
/**
* Renders the records into the table.
*
* @param response the report model
* @param document the current document
* @throws DocumentException may be thrown by the iText library while rendering the elements
*/
private void renderResults(PaymentByTypeRangeReportResponse response, Document document) throws DocumentException {
// table styling
Table table = new Table(4);
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[] {25, 25, 25, 25});
table.addCell(new Phrase("Retirement Type", ReportHelper.TABLE_HEADER_UNDERLINE));
table.addCell(new Phrase("CSD", ReportHelper.TABLE_HEADER_UNDERLINE));
table.addCell(ReportHelper.moneyCell("Amount", ReportHelper.TABLE_HEADER_UNDERLINE));
table.addCell(new Phrase("Date", ReportHelper.TABLE_HEADER_UNDERLINE));
// process rows
List<PaymentByTypeRangeReportResponseItem> items = response.getItems();
for (PaymentByTypeRangeReportResponseItem row : items) {
table.addCell(new Phrase(row.getRetirementType(), ReportHelper.TABLE_DATA_FONT));
table.addCell(new Phrase(row.getCsd(), ReportHelper.TABLE_DATA_FONT));
table.addCell(ReportHelper.moneyCell(ReportHelper.formatMoney(row.getPaymentAmount()),
ReportHelper.TABLE_DATA_FONT));
table.addCell(new Phrase(ReportHelper.formatDate(row.getDate(), "EEEE, MMMM dd, yyyy"),
ReportHelper.TABLE_DATA_FONT));
}
document.add(table);
}
开发者ID:NASA-Tournament-Lab,项目名称:CoECI-OPM-Service-Credit-Redeposit-Deposit-Application,代码行数:37,代码来源:PaymentByTypeRangeReportService.java
示例14: 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
示例15: writePdf
import com.lowagie.text.Table; //导入方法依赖的package包/类
/**
* Ecrit le pdf.
*
* @param table
* MBasicTable
* @param out
* OutputStream
* @throws IOException
* e
*/
protected void writePdf(final MBasicTable table, final OutputStream out) throws IOException {
try {
// step 1: creation of a document-object
final Rectangle pageSize = landscape ? PageSize.A4.rotate() : PageSize.A4;
final Document document = new Document(pageSize, 50, 50, 50, 50);
// step 2: we create a writer that listens to the document and directs a PDF-stream to out
createWriter(table, document, out);
// we add some meta information to the document, and we open it
document.addAuthor(System.getProperty("user.name"));
document.addCreator("JavaMelody");
final String title = buildTitle(table);
if (title != null) {
document.addTitle(title);
}
document.open();
// ouvre la boîte de dialogue Imprimer de Adobe Reader
// if (writer instanceof PdfWriter) {
// ((PdfWriter) writer).addJavaScript("this.print(true);", false);
// }
// table
final Table datatable = new Table(table.getColumnCount());
datatable.setCellsFitPage(true);
datatable.setPadding(4);
datatable.setSpacing(0);
// headers
renderHeaders(table, datatable);
// data rows
renderList(table, datatable);
document.add(datatable);
// we close the document
document.close();
} catch (final DocumentException e) {
// on ne peut déclarer d'exception autre que IOException en throws
throw new IOException(e);
}
}