Creating MS Word document in java

Creating MS Word document in java

I have one template in MS Word which has some content. Now i want to read this doc file and wants to add some content and also i need to set header and footer in doc file. That is, reading the doc file , do some changes , adding header footer and creating new doc file.Can you plz tell me how to do in java?
View Answers

February 7, 2011 at 11:15 AM

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);
    }
  }
}









Related Tutorials/Questions & Answers:
Creating MS Word document in java - Struts
Creating MS Word document in java  I have one template in MS Word... the doc file , do some changes , adding header footer and creating new doc file.Can you plz tell me how to do in java
java code to open and display MS-word document
java code to open and display MS-word document  java code to open and display MS-word document
Advertisements
create , edit MS WORD like document file using Java Swing - Swing AWT
create , edit MS WORD like document file using Java Swing   In my..., font style etc. I want this text in JTextArea to be saved to MS WORD like document file. Then how should I create, edit , retrieve this document file
create MS Word in Java - Java Beginners
which creates MS Word in Java...create MS Word in Java  Hi, Could any one please post the code which creates the word document having different paragraphs and two tables. i have
How to merge two word document using java
How to merge two word document using java   how to merge two word document using java
How to merge two word document using java
How to merge two word document using java   how to merge two word document using java
export to word document - Java Beginners
export to word document  hi sir,when i am click on a button under the jtable,for example (print button),then i want to print that jtable in word document,automatically,plz provide program sir  Hi Friend, Try
Edit word document Headers and Footers using POI Library in java?
Edit word document Headers and Footers using POI Library in java?  Hi All, I need code to modify the Header and Footer contents of a ms-word template using POI or JACOB libraries. Could any one help me? Thanks Advance
com in ms word
com in ms word  how to use com object to fetch data from ms word and storing it into sql database
com in ms word
com in ms word  how to use com object to fetch data from ms word and storing it into sql database
open word document
open word document  how to open a word document ??   Please go through the following link: Java Read word document file The above link will provide an example that will read the document file using POI library in java
open word document
open word document  how to open a word document ??   Please go through the following link: Java Read word document file The above link will provide an example that will read the document file using POI library in java
open word document
open word document  how to open a word document ??   Please go through the following link: Java Read word document file The above link will provide an example that will read the document file using POI library in java
Display the data to MS word
Display the data to MS word  i want help with displaying data on to ms word.When i click the button my web page my servlet should get the data from the database(say im searching using an id) and should display it on the ms word
viewing the ms word in print layout from jsp - Java Beginners
viewing the ms word in print layout from jsp  Hi all, I am trying to export ms word from jsp in print layout format.I used the code for converting into ms word but it is opening in web layout. My requirement
Write String in Word document
Write String in Word document  How to read and write strings in word document
Using poi hwpf,how to create table in word document. - Java Beginners
Using poi hwpf,how to create table in word document.  Can you please tell me how to create a table in the word document in java using Apache poi hwpf.its very urgent.Please send some sample code.Thanks in advance
Scanning a word in a TEXT document......
Scanning a word in a TEXT document......  Hi Genius persons... I'm having many resumes in my FOLDER called HARISH in D:(colon) i want to scan... by searching the JAVA and .net words present in the files..if JAVA word is present means
Scanning a word in a TEXT document......
Scanning a word in a TEXT document......  Hi Genius persons... I'm having many resumes in my FOLDER called HARISH in D:(colon) i want to scan... by searching the JAVA and .net words present in the files..if JAVA word is present means
ResultSet Object data to Ms-Word Doc
ResultSet Object data to Ms-Word Doc   help me , i don't know how to write data from oracle database into MSWord document using servlet or jsp
APACHE.POI -- Create word Document - Development process
the code which creates MS Word in Java... Raghu J...APACHE.POI -- Create word Document  Hi, Could any one please post the code which creates the word document having different paragraphs and two
convert word document to pdf
convert word document to pdf  Hi, Could you please help me write a java code that converts the word docuemnt into PDF? I have to save the generated... a java beginner. Please help out in this. Thanks in advance. Regards, Sindhu
store form data into word document
store form data into word document  i want form page data, ex username phone number.. to store it in a word document file
word document reading - Development process
word document reading  I am in the midst of reading a word document while reading charts(EMF or WMF) pictures i am not able to do so can u suggest one class for this to accomplish
to fetch data from ms word and storing into database
to fetch data from ms word and storing into database  i want to know how to fetch datafields from ms word and storing into database??? please answer soon .its urgent
POI Word document (Letter Template)
POI Word document (Letter Template)  Dear Team, i need code for generating word document(letter format). i am unable to get the code for formats, font settings, letter type settings. please help me for the same. Thanks
Open Text or Word Document on JButton Click in Java - Java Beginners
Open Text or Word Document on JButton Click in Java  How to open Word document or Text File on JButton Click in java  Hi Friend, Try the following code: import java.io.*; import java.util.*; import javax.swing.
creating document in XML - XML
creating document in XML  Create an XML document for catalogue... = documentBuilderFactory.newDocumentBuilder(); Document document = documentBuilder.newDocument(); Element rootElement
How to remove paragraph from ms word
How to remove paragraph from ms word  Hi! I am using MS Word to edit my text but somehow i get paragraph sign on every line of my text. So, can any one please tell me how to remove paragraph from ms word?   CTRL+SHIFT+8
JTextArea to Word Document
JTextArea to Word Document Jakarta POI has provided several classes that enable us to perform read, write operations with ms word file. Here we are going to write the data into word document file through a swing component. You can
How to hide text in Word Document using Apache POI library
How to hide text in Word Document using Apache POI library  Is it possible to hide text in MS Word Document using Apache POI library? If yes, please let me know how. I am able to create and read the document using POI library
creating tables as an xml document - XML
creating tables as an xml document  Create a table of a medal tally of the Olympic Games as an XML document. The table must have the name...(); DocumentBuilder docBuilder = builderFactory.newDocumentBuilder(); //creating a new
String file in to word file in java
String file in to word file in java  How to convert a String format notepad file into Ms word file in java
Will i be able to get the content of a webpage in a word document (Note:i don t have access to the source code)through java code?
Will i be able to get the content of a webpage in a word document (Note:i don t have access to the source code)through java code?  public class... am getting output to this code as html tags.... But what i want is in a word
String file in to word file in java
String file in to word file in java  how to convert a String format word file into Ms Word file using java? please can anyone of you help me
upload and retrieve a word document - JSP-Servlet
upload and retrieve a word document  Hi, I have a problem with uploading a word document to My sql database to a BLOB data type variable. And also unable to retrieve the word document from database. I am writing the code
PDF to Word Conversion - Java Beginners
PDF to Word Conversion  Hello, Can we convert a PDF document to Microsoft word document thru Java. If its not possible in Java, is it possible in any other language
Creating Blank DOM Document
Creating Blank DOM Document       This tutorial shows you how to create blank DOM document. JAXP... to create an empty dom document in Java?":ADS_TO_REPLACE_1 The class
How to set a microsoft word document PASSWORD by using Visual Basic 2008 express?
How to set a microsoft word document PASSWORD by using Visual Basic 2008 express?   How to set a microsoft word document PASSWORD by using Visual Basic 2008 express
Creating a memory leak with Java
Creating a memory leak with Java  Creating a memory leak with Java
Java Word Processor
Java Word Processor  Problem: Design and implement a class called... of words (a hyphenated word is one word), o number of sentences (ends...: ? You can break up a String into words or "tokens" by using java?s Scanner
Word replacment - Java Beginners
Word replacment  Java code for the Word Replacement.Thnaks in Advance!  Hipublic class WordReplaced{ public static void main(String[] args... information,http://www.roseindia.net/java
creating Xml - Java Beginners
creating Xml  how we can create a xml file using java Creating XML File is possible in java with this packages. import... this Elemnts to DOcumnet object. Creating XML File is possible  Creating XML File is possible
word program - Java Beginners
word program  HELLO MAM AND SIR I ASK YOUR HELP HOPE YOU GONNA HELP ME THANK YOU!!Design a program to search a word for letters that the user... within the word a letter that the user entered,change the value of the array
java &ms access - JDBC
java &ms access  Seasons Greetings, Am, creating an application for a food festival using Java swing as front end and MS access as Backend... ve managed to populate the JComboBox using MS Access. The problem is only 8 per
Creating PDF in JAVA
Creating PDF in JAVA  How create pdf in java ? Take value from database for particular PDF
java number to word - Java Beginners
java number to word  Can somebody please fix this to come out with the word, not the number 23? import java.util.Scanner; public class... { //----------------------------------------------------------------- // Pulls integers from a string to form a word
creating reports in java
creating reports in java  how to create reports automatically in java and send it via mail by scheduling tine for weekly,monthly basis
Java code to convert pdf file to word file
Java code to convert pdf file to word file  How to convert pdf file to word file using Java
open document
open document  open a word document using jsp   Please go through the following link: Java Read word document file The above link will provide an example that will read the document file using POI library in java

Ads