本文整理汇总了Java中com.lowagie.text.Table.addCell方法的典型用法代码示例。如果您正苦于以下问题:Java Table.addCell方法的具体用法?Java Table.addCell怎么用?Java Table.addCell使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.lowagie.text.Table
的用法示例。
在下文中一共展示了Table.addCell方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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();
}
}
示例2: 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;
}
示例3: 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
示例4: 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
示例5: 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
示例6: 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
示例7: insertDiagramLegend
import com.lowagie.text.Table; //导入方法依赖的package包/类
/**
* inserts the diagram figure legend
*
* @param document
* the document we are reporting into
* @param element
* the element illustrated by this diagram
* @param figureNo
* the diagram number
*/
public void insertDiagramLegend(Document document, URNmodelElement element, int figureNo) {
try {
Table headerTable = ReportUtils.createTable(1, 1, 0, 100);
Chunk name = new Chunk(Messages.getString("PDFReportDiagram.Figure") + figureNo + " - " + element.getName(), figureLegendFont); //$NON-NLS-1$ //$NON-NLS-2$
Cell nameCell = new Cell(name);
nameCell.setColspan(1);
nameCell.setHorizontalAlignment(Element.ALIGN_CENTER);
nameCell.setBorderWidthTop(2f);
headerTable.addCell(nameCell);
document.add(headerTable);
} catch (Exception e) {
jUCMNavErrorDialog error = new jUCMNavErrorDialog(e.getMessage());
e.printStackTrace();
}
}
示例8: insertDiagramDescription
import com.lowagie.text.Table; //导入方法依赖的package包/类
/**
* inserts the diagram figure description
*
* @param document
* the document we are reporting into
* @param element
* the element illustrated by this diagram
*/
public void insertDiagramDescription(Document document, URNmodelElement element) {
try {
Table table = ReportUtils.createTable(1, 2, 0, 100);
Chunk chunk = new Chunk(Messages.getString("PDFReportDiagram.Description"), descriptionBoldFont); //$NON-NLS-1$
Cell descriptionCell = new Cell(chunk);
descriptionCell.setColspan(1);
descriptionCell.setHorizontalAlignment(Element.ALIGN_LEFT);
descriptionCell.setBorderWidthBottom(1.5f);
Chunk descText = new Chunk(element.getDescription(), descriptionFont);
table.addCell(descriptionCell);
document.add(table);
document.add(descText);
} catch (Exception e) {
jUCMNavErrorDialog error = new jUCMNavErrorDialog(e.getMessage());
e.printStackTrace();
}
}
示例9: insertDiagramSectionHeader
import com.lowagie.text.Table; //导入方法依赖的package包/类
protected void insertDiagramSectionHeader(Document document, int[] tableParams, String description) {
try {
Table table = ReportUtils.createTable(tableParams[0], tableParams[1], tableParams[2], tableParams[3]);
Chunk chunk = new Chunk(description, descriptionBoldFont);
Cell descriptionCell = new Cell(chunk);
descriptionCell.setColspan(1);
descriptionCell.setHorizontalAlignment(Element.ALIGN_LEFT);
descriptionCell.setBorderWidthBottom(1.5f);
table.addCell(descriptionCell);
document.add(table);
} catch (Exception e) {
jUCMNavErrorDialog error = new jUCMNavErrorDialog(e.getMessage());
e.printStackTrace();
}
}
示例10: writeEvaluation
import com.lowagie.text.Table; //导入方法依赖的package包/类
/**
* creates the data dictionary section in the report
*
* @param table
* the in which to insert the evaluations
*/
protected void writeEvaluation(Table table, int evalValue ) throws IOException {
//evalValue = StrategyEvaluationPreferences.getValueToVisualize(evalValue);
// if 0,100, convert back to -100,100 to have the right color.
int colorValue = StrategyEvaluationPreferences.getEquivalentValueInFullRangeIfApplicable( urnSpec, evalValue );
Cell evaluationCell = new Cell(evalValue + ""); //$NON-NLS-1$
evaluationCell.setColspan(STRATEGY_CELL_WIDTH);
if (colorValue == 0) {
evaluationCell.setBackgroundColor(new java.awt.Color(255, 255, 151));
} else if (colorValue == -100) {
evaluationCell.setBackgroundColor(new java.awt.Color(252, 169, 171));
} else if (colorValue > -100 && colorValue < 0) {
evaluationCell.setBackgroundColor(new java.awt.Color(253, 233, 234));
} else if (colorValue == 100) {
evaluationCell.setBackgroundColor(new java.awt.Color(210, 249, 172));
} else if (colorValue > 0 && colorValue < 100) {
evaluationCell.setBackgroundColor(new java.awt.Color(240, 253, 227));
}
table.addCell(evaluationCell);
}
示例11: insertDiagramLegend
import com.lowagie.text.Table; //导入方法依赖的package包/类
/**
* inserts the diagram figure legend
*
* @param document
* the document we are reporting into
* @param element
* the element illustrated by this diagram
* @param i
* the diagram number
*/
public void insertDiagramLegend(Document document, URNmodelElement element, int i) {
try {
int figureNo = i + 1;
Table headerTable = ReportUtils.createTable(1, 1, 0, 100);
Chunk name = new Chunk(Messages.getString("RTFReportDiagram.Figure") + figureNo + " - " + element.getName(), figureLegendFont); //$NON-NLS-1$ //$NON-NLS-2$
Cell nameCell = new Cell(name);
nameCell.setColspan(1);
nameCell.setHorizontalAlignment(Element.ALIGN_CENTER);
nameCell.setBorderWidthTop(2f);
headerTable.addCell(nameCell);
document.add(headerTable);
} catch (Exception e) {
jUCMNavErrorDialog error = new jUCMNavErrorDialog(e.getMessage());
e.printStackTrace();
}
}
示例12: insertDiagramDescription
import com.lowagie.text.Table; //导入方法依赖的package包/类
/**
* inserts the diagram figure description
*
* @param document
* the document we are reporting into
* @param element
* the element illustrated by this diagram
*/
public void insertDiagramDescription(Document document, URNmodelElement element) {
try {
Table table = ReportUtils.createTable(1, 2, 0, 100);
Chunk chunk = new Chunk(Messages.getString("RTFReportDiagram.Description"), descriptionBoldFont); //$NON-NLS-1$
Cell descriptionCell = new Cell(chunk);
descriptionCell.setColspan(1);
descriptionCell.setHorizontalAlignment(Element.ALIGN_LEFT);
descriptionCell.setBorderWidthBottom(1.5f);
Chunk descText = new Chunk(element.getDescription(), descriptionFont);
table.addCell(descriptionCell);
document.add(table);
document.add(descText);
} catch (Exception e) {
jUCMNavErrorDialog error = new jUCMNavErrorDialog(e.getMessage());
e.printStackTrace();
}
}
示例13: insertHeader
import com.lowagie.text.Table; //导入方法依赖的package包/类
/**
* this helper method writes the header of the UCM scenario documentation section
*
* @param document
* the document we are reporting into
* @param message
* the string to be displayed in the header
* @param font
* the font we will use to display the header
*/
public void insertHeader(Document document, String message, Font font) {
try {
Table table = ReportUtils.createTable(tableParams[0], tableParams[1], tableParams[2], tableParams[3]);
Chunk chunk = new Chunk(message, font);
Cell descriptionCell = new Cell(chunk);
descriptionCell.setColspan(1);
descriptionCell.setHorizontalAlignment(Element.ALIGN_LEFT);
descriptionCell.setBorderWidthBottom(1.5f);
table.addCell(descriptionCell);
document.add(table);
} catch (Exception e) {
jUCMNavErrorDialog error = new jUCMNavErrorDialog(e.getMessage());
e.printStackTrace();
}
}
示例14: buildPdfDocument
import com.lowagie.text.Table; //导入方法依赖的package包/类
protected void buildPdfDocument(Map<String, Object> map, Document document,
PdfWriter pdfWriter, HttpServletRequest httpServletRequest,
HttpServletResponse httpServletResponse) throws Exception {
Map<String,String> userData = (Map<String,String>) map.get("userData");
Table table = new Table(2);
table.addCell("No.");
table.addCell("User Name");
for (Map.Entry<String, String> entry : userData.entrySet()) {
table.addCell(entry.getKey());
table.addCell(entry.getValue());
}
document.add(table);
}
示例15: main
import com.lowagie.text.Table; //导入方法依赖的package包/类
/**
* A very simple Table example.
*
*/
@Test
public void main() throws Exception {
// step 1: creation of a document-object
Document document = new Document();
// step 2:
// we create a writer that listens to the document
// and directs a PDF-stream to a file
PdfWriter.getInstance(document, PdfTestBase.getOutputStream("MyFirstTable.pdf"));
// step 3: we open the document
document.open();
// step 4: we create a table and add it to the document
Table table = new Table(2, 2); // 2 rows, 2 columns
table.addCell("0.0");
table.addCell("0.1");
table.addCell("1.0");
table.addCell("1.1");
document.add(table);
document.add(new Paragraph("converted to PdfPTable:"));
table.setConvert2pdfptable(true);
document.add(table);
// step 5: we close the document
document.close();
}