本文整理汇总了Java中com.lowagie.text.Table.endHeaders方法的典型用法代码示例。如果您正苦于以下问题:Java Table.endHeaders方法的具体用法?Java Table.endHeaders怎么用?Java Table.endHeaders使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.lowagie.text.Table
的用法示例。
在下文中一共展示了Table.endHeaders方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: 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;
}
示例3: 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;
}
示例4: 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();
}