Convert Text To Word

In this example, you will learn how to convert text to Word file.

Convert Text To Word

In this example, you will learn how to convert text to Word file.

Convert Text To Word

Convert Text To Word

     

In this example, You will learn how to convert text to word file. Here, we are going to discuss about the conversion of text to word file. 

Core Description:

The following program uses two constructors for converting text to word file. This program converts the text to word file by using FileOutputStream("TextToWord.doc"). This program writes the content in word file using write() method of OutputStreamWriter object.

Here is the code of this program:

import java.math.*;
import java.io.*;

public class TextToWord
  public static void main(String arg[]){
  try{
  FileOutputStream fs = new FileOutputStream("TextToWord.doc");
  OutputStreamWriter out = new OutputStreamWriter(fs);  
  out.write("Welcome to RoseIndia!");
  out.close();
  }
  catch (IOException e){
  System.err.println(e);
  }
  }
}

Download of this program:

Output of this program.