Example usage for com.lowagie.text.rtf.headerfooter RtfHeaderFooter RtfHeaderFooter

List of usage examples for com.lowagie.text.rtf.headerfooter RtfHeaderFooter RtfHeaderFooter

Introduction

In this page you can find the example usage for com.lowagie.text.rtf.headerfooter RtfHeaderFooter RtfHeaderFooter.

Prototype

public RtfHeaderFooter(Element[] elements) 

Source Link

Document

Constructs a RtfHeaderFooter for an array of Elements.

Usage

From source file:io.vertigo.dynamo.plugins.export.rtf.RTFExporter.java

License:Apache License

/** {@inheritDoc} */
@Override//from ww w . ja va2 s  .  com
protected void createWriter(final Document document, final OutputStream out) {
    // final RtfWriter2 writer =
    RtfWriter2.getInstance(document, out);
    // writer.setViewerPreferences(PdfWriter.PageLayoutTwoColumnLeft);

    // advanced page numbers : x/y
    final Font font = FontFactory.getFont(FontFactory.TIMES_ROMAN, 12, Font.NORMAL);
    //-----
    final Paragraph footerParagraph = new Paragraph();
    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);
}

From source file:io.vertigo.quarto.plugins.export.rtf.RTFExporter.java

License:Apache License

/** {@inheritDoc} */
@Override/*from ww  w  . jav a2 s .co m*/
protected void createWriter(final Document document, final OutputStream out) {
    RtfWriter2.getInstance(document, out);

    // advanced page numbers : x/y
    final Font font = FontFactory.getFont(FontFactory.TIMES_ROMAN, 12, Font.NORMAL);
    //-----
    final Paragraph footerParagraph = new Paragraph();
    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);
}

From source file:net.bull.javamelody.swing.print.MRtfWriter.java

License:Apache License

/**
 * We create a writer that listens to the document and directs a RTF-stream to out
 *
 * @param table/*from w w w. ja  v  a  2s . c  o  m*/
 *           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;
}

From source file:net.sf.eclipsecs.ui.stats.export.internal.RTFStatsExporter.java

License:Open Source License

private void createHeaderAndFooter(Document doc) {
    Paragraph p = new Paragraph("Checkstyle statistics", pageHeaderAndFooterFont);
    p.setAlignment(Element.ALIGN_CENTER);
    HeaderFooter header = new RtfHeaderFooter(p);
    doc.setHeader(header);//w ww  .jav a 2 s. c o m

    SimpleDateFormat simpleDateFormat = new SimpleDateFormat();
    p = new Paragraph("Gnr le : " + simpleDateFormat.format(new Date()), pageHeaderAndFooterFont);
    p.setAlignment(Element.ALIGN_CENTER);
    RtfHeaderFooterGroup footer = new RtfHeaderFooterGroup();
    footer.setHeaderFooter(new RtfHeaderFooter(p),
            com.lowagie.text.rtf.headerfooter.RtfHeaderFooter.DISPLAY_ALL_PAGES);
    doc.setFooter(footer);
}

From source file:ro.nextreports.engine.exporter.RtfExporter.java

License:Apache License

private void buildHeader() throws DocumentException, QueryException {
    header = buildRtfTable(PRINT_PAGE_HEADER);
    if (header == null) {
        return;/*from  w  ww.  j  a v a2s.c  o  m*/
    }
    printPageHeaderBand();
    HeaderFooter hf = new RtfHeaderFooter(header);
    document.setHeader(hf);
}

From source file:ro.nextreports.engine.exporter.RtfExporter.java

License:Apache License

private void buildFooter() throws DocumentException, QueryException {
    footer = buildRtfTable(PRINT_PAGE_FOOTER);
    if (footer == null) {
        return;//from w w  w  .  j  a v a2s  .co  m
    }
    printPageFooterBand();
    RtfHeaderFooterGroup footerGroup = new RtfHeaderFooterGroup();
    RtfHeaderFooter hf = new RtfHeaderFooter(footer);
    footerGroup.setHeaderFooter(hf, RtfHeaderFooter.DISPLAY_ALL_PAGES);
    document.setFooter(footerGroup);
}