Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

convert RTF to HTML

Posted on 2007-11-25
6
Medium Priority
?
3,646 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
6 Comments
 
LVL 9

Accepted Solution

by:
ysnky earned 600 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Suggested Courses

730 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