public void importRtfDocument ( InputStream documentSource , EventListener [ ] events ) throws IOException , DocumentException { 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 .