Solved

convert RTF to HTML

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

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.
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

705 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

18 Experts available now in Live!

Get 1:1 Help Now