Solved

convert RTF to HTML

Posted on 2007-11-25
6
3,634 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 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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

622 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