Example usage for com.lowagie.text.rtf.parser RtfParser importRtfDocumentIntoElement

List of usage examples for com.lowagie.text.rtf.parser RtfParser importRtfDocumentIntoElement

Introduction

In this page you can find the example usage for com.lowagie.text.rtf.parser RtfParser importRtfDocumentIntoElement.

Prototype

public void importRtfDocumentIntoElement(Element elem, InputStream readerIn, RtfDocument rtfDoc)
        throws IOException 

Source Link

Document

Imports a complete RTF document into an Element, i.e.

Usage

From source file:org.pentaho.reporting.engine.classic.core.modules.output.table.rtf.itext.PatchRtfWriter2.java

License:Open Source License

/**
 * Adds the complete RTF document to the current RTF element being generated. It will parse the font and color tables
 * and correct the font and color references so that the imported RTF document retains its formattings.
 *
 * @param elem/*from w w  w .j  a v  a  2s  . c o m*/
 *          The Element the RTF document is to be imported into.
 * @param documentSource
 *          The Reader to read the RTF document from.
 * @param events
 *          The event array for listeners.
 * @throws IOException
 *           On errors reading the RTF document.
 * @throws DocumentException
 *           On errors adding to this RTF document.
 * @since 2.1.4
 */
public void importRtfDocumentIntoElement(Element elem, FileInputStream documentSource, EventListener[] events)
        throws IOException, DocumentException {

    RtfParser rtfImport = new RtfParser(this.document);
    if (events != null) {
        for (int idx = 0; idx < events.length; idx++) {
            rtfImport.addListener(events[idx]);
        }
    }
    rtfImport.importRtfDocumentIntoElement(elem, documentSource, rtfDoc);
}