本文整理匯總了Java中com.itextpdf.text.pdf.PdfPTable.setWidthPercentage方法的典型用法代碼示例。如果您正苦於以下問題:Java PdfPTable.setWidthPercentage方法的具體用法?Java PdfPTable.setWidthPercentage怎麽用?Java PdfPTable.setWidthPercentage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.itextpdf.text.pdf.PdfPTable
的用法示例。
在下文中一共展示了PdfPTable.setWidthPercentage方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: cellRodape
import com.itextpdf.text.pdf.PdfPTable; //導入方法依賴的package包/類
private PdfPTable cellRodape(String value, boolean l,boolean r,int align)
{
Font fontCorpoTableO= FontFactory.getFont(Fontes.FONT, BaseFont.WINANSI, BaseFont.EMBEDDED ,7.5f);
PdfPTable pTable = new PdfPTable(1);
pTable.setWidthPercentage(100f);
PdfPCell cellValue = new PdfPCell(new Phrase(value,fontCorpoTableO));
if(l){cellValue.setBorderWidthLeft(0);}
if(r){cellValue.setBorderWidthRight(0);}
switch (align)
{
case Element.ALIGN_RIGHT:cellValue.setHorizontalAlignment(Element.ALIGN_RIGHT);break;
case Element.ALIGN_LEFT:cellValue.setHorizontalAlignment(Element.ALIGN_LEFT);break;
case Element.ALIGN_CENTER:cellValue.setHorizontalAlignment(Element.ALIGN_CENTER);break;
default:break;
}
pTable.addCell(cellValue);
return pTable;
}
示例2: generatePage
import com.itextpdf.text.pdf.PdfPTable; //導入方法依賴的package包/類
@Override
public PdfPTable generatePage() throws Exception {
Image image = Image.getInstance(imageFile.toURL());
float heightToWidthRatio = (210f / 297f);
Image imageCropped = ImageUtils.cropImageToMeetRatio(pdfWriter, image, heightToWidthRatio);
PdfPCell cell = new PdfPCell(imageCropped, true);
cell.setBorder(0);
cell.setPadding(COVER_MARGIN);
cell.setHorizontalAlignment(Element.ALIGN_CENTER);
cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
cell.setExtraParagraphSpace(0);
cell.setRightIndent(0);
PdfPTable table = new PdfPTable(1);
;
table.setWidthPercentage(100f);
table.setWidths(new int[]{1});
table.setExtendLastRow(true);
table.addCell(cell);
return table;
}
示例3: createGridTable
import com.itextpdf.text.pdf.PdfPTable; //導入方法依賴的package包/類
protected PdfPTable createGridTable(ReportDataModel dataModel, boolean isRepeatHeader) throws Exception {
PdfPTable table = new PdfPTable(calculateGridColumnCount(dataModel.getTopColumnHeaders()));
table.setWidthPercentage(100);
Collection<ColumnHeader> topHeaders = dataModel.getTopColumnHeaders();
List<Integer> widths = new ArrayList<Integer>();
generateGridColumnWidths(topHeaders, widths);
int[] values = new int[widths.size()];
for (int i = 0; i < widths.size(); i++) {
values[i] = widths.get(i);
}
table.setWidths(values);
int maxHeaderLevel = getGridMaxColumngroup(topHeaders);
createGridColumnHeader(table, topHeaders, maxHeaderLevel);
createGridTableDatas(table, dataModel.getReportData());
if (isRepeatHeader) {
table.setHeaderRows(maxHeaderLevel);
}
return table;
}
示例4: addOfferInstances
import com.itextpdf.text.pdf.PdfPTable; //導入方法依賴的package包/類
private void addOfferInstances(List<OfferInstance> offerInstances, Document document, BaseFont bf)
throws DocumentException {
if(offerInstances.isEmpty()) {
return;
}
document.add(new Paragraph("Wybrane oferty: ", new Font(bf, 12)));
PdfPTable offerInstancesTable = new PdfPTable(3);
offerInstancesTable.setWidthPercentage(100);
offerInstancesTable.setSpacingBefore(18f);
offerInstancesTable.setSpacingAfter(18f);
createofferInstancesTableHeaders(offerInstancesTable);
createofferInstancesTableContent(offerInstances, offerInstancesTable);
document.add(offerInstancesTable);
}
示例5: createFooterTable
import com.itextpdf.text.pdf.PdfPTable; //導入方法依賴的package包/類
/**
* <a href="http://stackoverflow.com/questions/43807931/creating-table-in-pdf-on-last-page-bottom-wrong-official-solution">
* Creating table in pdf on last page bottom (wrong official solution)
* </a>
* <p>
* Helper method for {@link #testCreateTableLikeUser7968180()}.
* </p>
*/
private static PdfPTable createFooterTable() throws DocumentException
{
int[] columnWidths = new int[] { 1, 1, 1, 1, 1, 1, 1, 1, 1 };
PdfPTable datatable = new PdfPTable(columnWidths.length);
datatable.setKeepTogether(true);
datatable.setWidthPercentage(100);
datatable.setWidths(columnWidths);
datatable.getDefaultCell().setPadding(5);
// datatable.getDefaultCell().setHorizontalAlignment(horizontalAlignment);
// datatable.getDefaultCell().setVerticalAlignment(verticalAlignment);
for (int i = 0; i < 100; i++)
{
datatable.addCell("Přehledová tabulka");
// addCellToTable(datatable, horizontalAlignmentLeft, verticalAlignmentMiddle, "Přehledová tabulka",
// columnWidths.length, 1, fontTypeBold, fontSizeRegular, cellLayout_Bottom);
}
return datatable;
}
示例6: tableWithPageNumber
import com.itextpdf.text.pdf.PdfPTable; //導入方法依賴的package包/類
private PdfPTable tableWithPageNumber() throws DocumentException, IOException {
PdfPTable innerTable = new PdfPTable(1);
innerTable.setWidths(new int[]{1});
innerTable.setWidthPercentage(100);
innerTable.setPaddingTop(0);
innerTable.addCell(new PageNumberCellGenerator(pageNumber, BackgroundColorGenerator.DEFAULT_BACKGROUND_COLOR)
.generateTile());
PdfPCell cell = new PdfPCell();
cell.setVerticalAlignment(Element.ALIGN_BOTTOM);
cell.setHorizontalAlignment(Element.ALIGN_CENTER);
cell.setBorder(0);
cell.setPadding(0);
cell.addElement(innerTable);
PdfPTable table = new PdfPTable(1);
table.setWidthPercentage(100f);
table.setWidths(new int[]{1});
table.setExtendLastRow(true);
table.addCell(cell);
return table;
}
示例7: generatePage
import com.itextpdf.text.pdf.PdfPTable; //導入方法依賴的package包/類
@Override
public PdfPTable generatePage() throws DocumentException, IOException, URISyntaxException {
PdfPTable table = new PdfPTable(12); // Bootstrap style
table.setWidthPercentage(100f);
table.setWidths(new int[]{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1});
table.setExtendLastRow(true);
table.addCell(generateHeaderTitle());
table.addCell(generateHeaderData());
table.addCell(generatePhoto());
table.addCell(generateMapImage());
table.addCell(generateDescription());
table.addCell(generateFooter());
return table;
}
示例8: generateFooter
import com.itextpdf.text.pdf.PdfPTable; //導入方法依賴的package包/類
private PdfPCell generateFooter() throws IOException, DocumentException, URISyntaxException {
PdfPCell cell = new PdfPCell();
cell.setColspan(12);
cell.setVerticalAlignment(Element.ALIGN_BOTTOM);
cell.setHorizontalAlignment(Element.ALIGN_CENTER);
cell.setBorder(0);
cell.setPadding(0);
PdfPTable innerTable = new PdfPTable(2);
innerTable.getDefaultCell().setBorder(0);
innerTable.setWidths(new int[]{1, 1});
innerTable.setWidthPercentage(100);
innerTable.addCell(generateStamp());
innerTable.addCell(new PageNumberCellGenerator(pageNumber, backgroundColor).generateTile());
cell.addElement(innerTable);
return cell;
}
示例9: writeTree
import com.itextpdf.text.pdf.PdfPTable; //導入方法依賴的package包/類
private void writeTree(Document document) throws DocumentException, IOException {
if(mTreeReport == null) {
return;
}
Paragraph title = createTitleParagraph();
document.add(title);
addSpace(document);
PdfPTable titleTable = new PdfPTable(new float[]{1f, 3f});
titleTable.setWidthPercentage(100f);
getParagraph(titleTable, MobileRangerApplication.getAppContext().getString(R.string.form_date_title), mTreeReport.getDate(), 0);
getParagraph(titleTable, MobileRangerApplication.getAppContext().getString(R.string.form_reporting_employee_title), mTreeReport.getReportingEmployee(), 0);
document.add(titleTable);
addSpace(document);
if(mTreeReport.getLocations() != null && mTreeReport.getLocations().size() > 0) {
for (TreeLocation location : mTreeReport.getLocations()) {
PdfPTable table = createTableForLocation(location);
document.add(table);
document.newPage();
}
}
}
示例10: buildFooterVersetzungsvermerkLine
import com.itextpdf.text.pdf.PdfPTable; //導入方法依賴的package包/類
public static PdfPTable buildFooterVersetzungsvermerkLine(String versetzungsvermerk, Font footerFont) throws DocumentException {
PdfPCell labelCell = new PdfPCell(new Phrase("Versetzungsvermerk", footerFont));
labelCell.setBorder(Rectangle.BOTTOM);
labelCell.setBorderWidth(1f);
PdfPCell nameCell = new PdfPCell(new Phrase(versetzungsvermerk, footerFont));
nameCell.setBorder(Rectangle.BOTTOM);
nameCell.setBorderWidth(1f);
PdfPTable table = new PdfPTable(2);
table.setHorizontalAlignment(Element.ALIGN_LEFT);
table.setWidthPercentage(100f);
table.addCell(labelCell);
table.addCell(nameCell);
table.setWidths(new float[] {0.3f, 0.7f});
return table;
}
示例11: buildFooterDatumLine
import com.itextpdf.text.pdf.PdfPTable; //導入方法依賴的package包/類
public static PdfPTable buildFooterDatumLine(String datumString, Font footerFont) throws DocumentException {
PdfPCell labelCell = new PdfPCell(new Phrase("Datum", footerFont));
labelCell.setBorder(Rectangle.BOTTOM);
labelCell.setBorderWidth(1f);
PdfPCell nameCell = new PdfPCell(new Phrase(datumString, footerFont));
nameCell.setBorder(Rectangle.BOTTOM);
nameCell.setBorderWidth(1f);
PdfPTable table = new PdfPTable(2);
table.setHorizontalAlignment(Element.ALIGN_LEFT);
table.setWidthPercentage(100f);
table.addCell(labelCell);
table.addCell(nameCell);
table.setWidths(new float[] {0.3f, 0.7f});
return table;
}
示例12: buildFooterDienstsiegelLine
import com.itextpdf.text.pdf.PdfPTable; //導入方法依賴的package包/類
public static PdfPTable buildFooterDienstsiegelLine(Font footerFont) throws DocumentException {
PdfPCell leftCell = new PdfPCell(new Phrase("", footerFont));
leftCell.setBorder(Rectangle.NO_BORDER);
leftCell.setBorderWidth(1f);
PdfPCell centerCell = new PdfPCell(new Phrase("Dienstsiegel der Schule", footerFont));
centerCell.setBorder(Rectangle.NO_BORDER);
centerCell.setBorderWidth(1f);
centerCell.setHorizontalAlignment(Element.ALIGN_CENTER);
PdfPCell rightCell = new PdfPCell(new Phrase("", footerFont));
rightCell.setBorder(Rectangle.NO_BORDER);
rightCell.setBorderWidth(1f);
PdfPTable table = new PdfPTable(3);
table.setHorizontalAlignment(Element.ALIGN_MIDDLE);
table.setWidthPercentage(100f);
table.addCell(leftCell);
table.addCell(centerCell);
table.addCell(rightCell);
table.setWidths(new float[] {0.3f, 0.3f, 0.3f});
return table;
}
示例13: buildFooterUnterschriftenLine
import com.itextpdf.text.pdf.PdfPTable; //導入方法依賴的package包/類
public static PdfPTable buildFooterUnterschriftenLine(Font footerFont) throws DocumentException {
PdfPCell leftCell = new PdfPCell(new Phrase("Schulleiter(in)", footerFont));
leftCell.setBorder(Rectangle.TOP);
leftCell.setBorderWidth(1f);
leftCell.setHorizontalAlignment(Element.ALIGN_CENTER);
PdfPCell centerCell = new PdfPCell(new Phrase("", footerFont));
centerCell.setBorder(Rectangle.TOP);
centerCell.setBorderWidth(1f);
centerCell.setHorizontalAlignment(Element.ALIGN_CENTER);
PdfPCell rightCell = new PdfPCell(new Phrase("Klassenleiter(in)", footerFont));
rightCell.setBorder(Rectangle.TOP);
rightCell.setBorderWidth(1f);
rightCell.setHorizontalAlignment(Element.ALIGN_CENTER);
PdfPTable table = new PdfPTable(3);
table.setWidthPercentage(100f);
table.addCell(leftCell);
table.addCell(centerCell);
table.addCell(rightCell);
table.setWidths(new float[] {0.3f, 0.3f, 0.3f});
return table;
}
示例14: buildFooterHalbjahrDatumLine
import com.itextpdf.text.pdf.PdfPTable; //導入方法依賴的package包/類
public static PdfPTable buildFooterHalbjahrDatumLine(String datumString, Font footerFont) throws DocumentException {
PdfPCell leftCell = new PdfPCell(new Phrase(datumString, footerFont));
leftCell.setBorder(Rectangle.NO_BORDER);
leftCell.setHorizontalAlignment(Element.ALIGN_CENTER);
PdfPCell centerCell = new PdfPCell(new Phrase("", footerFont));
centerCell.setBorder(Rectangle.NO_BORDER);
centerCell.setHorizontalAlignment(Element.ALIGN_CENTER);
PdfPCell rightCell = new PdfPCell(new Phrase("", footerFont));
rightCell.setBorder(Rectangle.NO_BORDER);
rightCell.setHorizontalAlignment(Element.ALIGN_CENTER);
PdfPTable table = new PdfPTable(3);
table.setWidthPercentage(100f);
table.addCell(leftCell);
table.addCell(centerCell);
table.addCell(rightCell);
table.setWidths(new float[] {0.3f, 0.3f, 0.3f});
return table;
}
示例15: buildFooterHalbjahrDatumKlassenleiterLine
import com.itextpdf.text.pdf.PdfPTable; //導入方法依賴的package包/類
public static PdfPTable buildFooterHalbjahrDatumKlassenleiterLine(Font footerFont) throws DocumentException {
PdfPCell leftCell = new PdfPCell(new Phrase("Datum", footerFont));
leftCell.setBorder(Rectangle.TOP);
leftCell.setBorderWidth(1f);
leftCell.setHorizontalAlignment(Element.ALIGN_CENTER);
PdfPCell centerCell = new PdfPCell(new Phrase("", footerFont));
centerCell.setBorder(Rectangle.TOP);
centerCell.setBorderWidth(1f);
centerCell.setHorizontalAlignment(Element.ALIGN_CENTER);
PdfPCell rightCell = new PdfPCell(new Phrase("Klassenleiter(in)", footerFont));
rightCell.setBorder(Rectangle.TOP);
rightCell.setBorderWidth(1f);
rightCell.setHorizontalAlignment(Element.ALIGN_CENTER);
PdfPTable table = new PdfPTable(3);
table.setWidthPercentage(100f);
table.addCell(leftCell);
table.addCell(centerCell);
table.addCell(rightCell);
table.setWidths(new float[] {0.3f, 0.3f, 0.3f});
return table;
}