/** * Imports a complete RTF document. * * @param reader The Reader to read the RTF document from. * @param rtfDoc The RtfDocument to add the imported document to. * @throws IOException On I/O errors. * @throws DocumentException On document writing errors. */ public void ImportRtfDocument(TextReader reader, RtfDocument rtfDoc) { this.rtfDoc = rtfDoc; this.state = PARSER_IN_HEADER; this.importHeader = new RtfImportHeader(this.rtfDoc); this.fontTableParser = new RtfFontTableParser(this.importHeader); this.colorTableParser = new RtfColorTableParser(this.importHeader); this.tokeniser = new RtfTokeniser(this, 0); this.tokeniser.Tokenise(reader); }
/** * Imports an RTF fragment. * * @param reader The Reader to read the RTF fragment from. * @param rtfDoc The RTF document to add the RTF fragment to. * @param importMappings The RtfImportMappings defining font and color mappings for the fragment. * @throws IOException On I/O errors. * @throws DocumentException On document writing errors. */ public void ImportRtfFragment(TextReader reader, RtfDocument rtfDoc, RtfImportMappings importMappings) { this.rtfDoc = rtfDoc; this.state = PARSER_IN_DOCUMENT; this.importHeader = new RtfImportHeader(this.rtfDoc); this.fontTableParser = new RtfFontTableParser(this.importHeader); this.colorTableParser = new RtfColorTableParser(this.importHeader); HandleImportMappings(importMappings); this.tokeniser = new RtfTokeniser(this, 1); this.tokeniser.Tokenise(reader); }