Solved

convert RTF to HTML

Posted on 2007-11-25
6
3,614 Views
Last Modified: 2013-12-29
Can anybody tell me where i can find java implemetation of RTF to HTML and vice-versa.
0
Comment
Question by:sasankad
  • 2
6 Comments
 
LVL 9

Accepted Solution

by:
ysnky earned 150 total points
ID: 20348475
0
 
LVL 3

Expert Comment

by:ramiseesniblic
ID: 20778428
A couple of questions:

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

Expert Comment

by:ramiseesniblic
ID: 20778941

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
 
LVL 1

Expert Comment

by:Yogeshup
ID: 34152609
Can any one suggest me HTML to RTF for java applications?
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
java jdbc batch example 8 29
servlet example 17 28
How to determine if a string is a valid SHA value 7 28
Which non-HTML GUI front end to use with Java? 3 19
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now