本文整理汇总了Java中com.lowagie.text.HeaderFooter.setAlignment方法的典型用法代码示例。如果您正苦于以下问题:Java HeaderFooter.setAlignment方法的具体用法?Java HeaderFooter.setAlignment怎么用?Java HeaderFooter.setAlignment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.lowagie.text.HeaderFooter
的用法示例。
在下文中一共展示了HeaderFooter.setAlignment方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createWriter
import com.lowagie.text.HeaderFooter; //导入方法依赖的package包/类
/**
* We create a writer that listens to the document and directs a PDF-stream to out
*
* @param table
* MBasicTable
* @param document
* Document
* @param out
* OutputStream
* @return DocWriter
* @throws DocumentException
* e
*/
protected DocWriter createWriter(final MBasicTable table, final Document document,
final OutputStream out) throws DocumentException {
final PdfWriter writer = PdfWriter.getInstance(document, out);
// writer.setViewerPreferences(PdfWriter.PageLayoutTwoColumnLeft);
// title
if (table.getName() != null) {
final HeaderFooter header = new HeaderFooter(new Phrase(table.getName()), false);
header.setAlignment(Element.ALIGN_LEFT);
header.setBorder(Rectangle.NO_BORDER);
document.setHeader(header);
document.addTitle(table.getName());
}
// simple page numbers : x
// HeaderFooter footer = new HeaderFooter(new Phrase(), true);
// footer.setAlignment(Element.ALIGN_RIGHT);
// footer.setBorder(Rectangle.TOP);
// document.setFooter(footer);
// add the event handler for advanced page numbers : x/y
writer.setPageEvent(new AdvancedPageNumberEvents());
return writer;
}
示例2: generateSimpleHeader
import com.lowagie.text.HeaderFooter; //导入方法依赖的package包/类
/**
* Creates a common format header for the reports.
*
* @param document the report document
* @param reportGenerationDate the date of printing
* @param reportNameText the name of the report
* @return the header to include
*/
public static HeaderFooter generateSimpleHeader(Document document, Date reportGenerationDate,
String reportNameText) {
Paragraph header = new Paragraph();
if (reportNameText != null) {
Paragraph reportName = new Paragraph(reportNameText, ReportHelper.REPORT_HEADER_FONT);
header.add(reportName);
}
if (reportGenerationDate != null) {
Paragraph reportDate = new Paragraph(
new SimpleDateFormat(HEADER_DATE_FORMAT, Locale.US).format(reportGenerationDate),
ReportHelper.HEADER_DATE_FONT);
header.add(reportDate);
}
HeaderFooter head = new HeaderFooter(new Phrase(header), false);
head.setAlignment(Element.ALIGN_CENTER);
head.setBorder(Rectangle.BOTTOM);
return head;
}
开发者ID:NASA-Tournament-Lab,项目名称:CoECI-OPM-Service-Credit-Redeposit-Deposit-Application,代码行数:30,代码来源:ReportHelper.java
示例3: setFooterOnDocument
import com.lowagie.text.HeaderFooter; //导入方法依赖的package包/类
public static void setFooterOnDocument( Document document, String footerText, Font font )
{
boolean isNumbered = true;
HeaderFooter footer = new HeaderFooter( new Phrase( footerText, font ), isNumbered );
footer.setBorder( Rectangle.NO_BORDER );
footer.setAlignment( Element.ALIGN_RIGHT );
document.setFooter( footer );
}
示例4: addFooter
import com.lowagie.text.HeaderFooter; //导入方法依赖的package包/类
public void addFooter(String text)
{
HeaderFooter footer = new HeaderFooter((new Phrase(text+" - Pag. ",paragraphFont)),true);;
footer.setAlignment(HeaderFooter.ALIGN_RIGHT);
footer.disableBorderSide(HeaderFooter.BOTTOM);
document.setFooter(footer);
}
示例5: createWriter
import com.lowagie.text.HeaderFooter; //导入方法依赖的package包/类
private void createWriter(Document document, String title)
throws DocumentException, IOException {
final PdfWriter writer = PdfWriter.getInstance(document, output);
//writer.setViewerPreferences(PdfWriter.PageLayoutTwoColumnLeft);
// title
final HeaderFooter header = new HeaderFooter(new Phrase(title), false);
header.setAlignment(Element.ALIGN_LEFT);
header.setBorder(Rectangle.NO_BORDER);
document.setHeader(header);
// simple page numbers : x
//HeaderFooter footer = new HeaderFooter(new Phrase(), true);
//footer.setAlignment(Element.ALIGN_RIGHT);
//footer.setBorder(Rectangle.TOP);
//document.setFooter(footer);
// add the event handler for advanced page numbers : x/y
writer.setPageEvent(new PdfAdvancedPageNumberEvents());
}
示例6: createWriter
import com.lowagie.text.HeaderFooter; //导入方法依赖的package包/类
/**
* We create a writer that listens to the document and directs a RTF-stream to out
*
* @param table
* MBasicTable
* @param document
* Document
* @param out
* OutputStream
* @return DocWriter
*/
@Override
protected DocWriter createWriter(final MBasicTable table, final Document document,
final OutputStream out) {
final RtfWriter2 writer = RtfWriter2.getInstance(document, out);
// title
final String title = buildTitle(table);
if (title != null) {
final HeaderFooter header = new RtfHeaderFooter(new Paragraph(title));
header.setAlignment(Element.ALIGN_LEFT);
header.setBorder(Rectangle.NO_BORDER);
document.setHeader(header);
document.addTitle(title);
}
// advanced page numbers : x/y
final Paragraph footerParagraph = new Paragraph();
final Font font = FontFactory.getFont(FontFactory.TIMES_ROMAN, 12, Font.NORMAL);
footerParagraph.add(new RtfPageNumber(font));
footerParagraph.add(new Phrase(" / ", font));
footerParagraph.add(new RtfTotalPageNumber(font));
footerParagraph.setAlignment(Element.ALIGN_CENTER);
final HeaderFooter footer = new RtfHeaderFooter(footerParagraph);
footer.setBorder(Rectangle.TOP);
document.setFooter(footer);
return writer;
}
示例7: doExport
import com.lowagie.text.HeaderFooter; //导入方法依赖的package包/类
/**
* Do export.
*
* @param out
* the out
* @throws JspException
* the jsp exception
* @see org.displaytag.export.BinaryExportView#doExport(OutputStream)
*/
public void doExport(OutputStream out) throws JspException {
try {
// Initialize the table with the appropriate number of columns
initTable();
// Initialize the Document and register it with PdfWriter listener
// and the OutputStream
Document document = new Document(PageSize.A4.rotate(), 60, 60, 40, 40);
document.addCreationDate();
HeaderFooter footer = new HeaderFooter(new Phrase(TagConstants.EMPTY_STRING, smallFont), true);
footer.setBorder(Rectangle.NO_BORDER);
footer.setAlignment(Element.ALIGN_CENTER);
PdfWriter.getInstance(document, out);
// Fill the virtual PDF table with the necessary data
generatePDFTable();
document.open();
document.setFooter(footer);
document.add(this.tablePDF);
document.close();
} catch (Exception e) {
throw new PdfGenerationException(e);
}
}
示例8: generateHeaderNoBorder
import com.lowagie.text.HeaderFooter; //导入方法依赖的package包/类
/**
* Creates a common format header for the reports, without a header border.
*
* @param document the report document
* @param reportGenerationDate the date of printing
* @param reportNameText the name of the report
* @param subTitle report sub title
* @return the header to include
* @since 1.1
*/
public static HeaderFooter generateHeaderNoBorder(Document document, Date reportGenerationDate,
String reportNameText, String subTitle) {
Paragraph header = new Paragraph();
if (reportNameText != null) {
Paragraph reportName = new Paragraph(reportNameText, ReportHelper.REPORT_HEADER_FONT);
header.add(reportName);
}
if (reportGenerationDate != null) {
Paragraph reportDate = new Paragraph(
new SimpleDateFormat(HEADER_DATE_FORMAT, Locale.US).format(reportGenerationDate),
ReportHelper.HEADER_DATE_FONT);
header.add(reportDate);
}
if (subTitle != null) {
Paragraph sub = new Paragraph(subTitle, ReportHelper.HEADER_SUB_TITLE_FONT);
header.add(sub);
}
HeaderFooter head = new HeaderFooter(new Phrase(header), false);
head.setAlignment(Element.ALIGN_CENTER);
head.setBorder(Rectangle.NO_BORDER);
return head;
}
开发者ID:NASA-Tournament-Lab,项目名称:CoECI-OPM-Service-Credit-Redeposit-Deposit-Application,代码行数:37,代码来源:ReportHelper.java
示例9: setHeaderFooter
import com.lowagie.text.HeaderFooter; //导入方法依赖的package包/类
public static void setHeaderFooter(Document doc, String headerText) {
HeaderFooter footer = new HeaderFooter(new Phrase(" ", FontFactory.getFont("Helvetica", 8, Font.NORMAL, Color.BLACK)), true);
footer.setBorderWidth(0);
footer.setBorderWidthTop(1);
footer.setAlignment(HeaderFooter.ALIGN_RIGHT);
doc.setFooter(footer);
HeaderFooter header = new HeaderFooter(new Phrase(headerText, FontFactory.getFont("Helvetica", 14, Font.BOLD, Color.BLACK)), false);
doc.setHeader(header);
}
示例10: setHeaderFooter
import com.lowagie.text.HeaderFooter; //导入方法依赖的package包/类
public void setHeaderFooter(Document doc, String headerText) {
HeaderFooter footer = new HeaderFooter(new Phrase(fontFamilySelector.process(" ", FontContext.SMALL_NORMAL_HELVETICA)), true);
footer.setBorderWidth(0);
footer.setBorderWidthTop(1);
footer.setAlignment(HeaderFooter.ALIGN_RIGHT);
doc.setFooter(footer);
HeaderFooter header = new HeaderFooter(new Phrase(fontFamilySelector.process(headerText, FontContext.FOOTER_BOLD_HELVETICA)), false);
doc.setHeader(header);
}