/** * Adds the complete RTF document to the current RTF document 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 documentSource The Reader to read the RTF document from. * @throws IOException On errors reading the RTF document. * @throws DocumentException On errors adding to this RTF document. */ public void ImportRtfDocument(TextReader documentSource) { if (!this.open) { throw new DocumentException("The document must be open to import RTF documents."); } RtfParser rtfImport = new RtfParser(); rtfImport.ImportRtfDocument(documentSource, this.rtfDoc); }
/** * Adds the complete RTF document to the current RTF document 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. * Uses new RtfParser object. * * @param documentSource The Stream to read the RTF document from. * @param eventListeners The array of event listeners. May be null * @throws IOException * @throws DocumentException * * @see com.lowagie.text.rtf.parser.RtfParser * @see com.lowagie.text.rtf.parser.RtfParser#importRtfDocument(Reader, RtfDocument) * @since 2.0.8 * @author Howard Shank */ public void ImportRtfDocument(Stream documentSource, IEventListener[] events) { if (!this.open) { throw new DocumentException("The document must be open to import RTF documents."); } RtfParser rtfImport = new RtfParser(this.document); if (events != null) { for (int idx = 0; idx < events.Length; idx++) { rtfImport.AddListener(events[idx]); } } rtfImport.ImportRtfDocument(documentSource, this.rtfDoc); }
/** * Adds the complete RTF document to the current RTF document 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. * Uses new RtfParser object. * * @param documentSource The Stream to read the RTF document from. * @param eventListeners The array of event listeners. May be null * @throws IOException * @throws DocumentException * * @see com.lowagie.text.rtf.parser.RtfParser * @see com.lowagie.text.rtf.parser.RtfParser#importRtfDocument(Reader, RtfDocument) * @since 2.0.8 * @author Howard Shank */ public void ImportRtfDocument(Stream documentSource, IEventListener[] events) { if (!this.open) { throw new DocumentException(MessageLocalization.GetComposedMessage("the.document.must.be.open.to.import.rtf.documents")); } RtfParser rtfImport = new RtfParser(this.document); if (events != null) { for (int idx = 0; idx < events.Length; idx++) { rtfImport.AddListener(events[idx]); } } rtfImport.ImportRtfDocument(documentSource, this.rtfDoc); }