• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3657
  • Last Modified:

convert RTF to HTML

Can anybody tell me where i can find java implemetation of RTF to HTML and vice-versa.
0
sasankad
Asked:
sasankad
  • 2
1 Solution
 
ramiseesniblicCommented:
A couple of questions:

1. Does the HTML need to be XHTML complient?
2. Do you have access to java SWING?
0
 
ramiseesniblicCommented:

public static void main(String[] args) {
  try {                                    
    Writer sOut = new StringWriter();
    FileWriter out = new FileWriter("C:\\rtf\\test.html");
    FileInputStream fi = new FileInputStream( "C:\\rtf\\test.RTF" );
    try{
                  
      DefaultStyledDocument doc = new DefaultStyledDocument();                  
      HTMLEditorKit htmlKit = new HTMLEditorKit();                  
      RTFEditorKit rtf = new RTFEditorKit();
    
      rtf.read( fi, doc, 0 );
      htmlKit.write(sOut, doc, 0, doc.getLength());
    
      out.write(sOut.toString());    
    }finally{
      sOut.close();
      out.close();
      fi.close();
    }              
 
  }catch( Exception e ){
    System.out.println( e.toString() );
  }
}

Open in new window

0
 
YogeshupCommented:
Can any one suggest me HTML to RTF for java applications?
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now