Opening a Word document in the browser


Web tier: servlets, JSP, Web frameworks: Opening a Word document in the browser

  1. Opening a Word document in the browser (6 messages)


    i have to write a servlet ,which will write a report to a word document.
    the data is raw ,and is to be printed in a table format on the word document.
    can anyone please tell ,me how to go about it ?if there are any APIs already available ,to open/create a new ,word document and modify it.
    so that this word document can be shown on the browser.

    thanks in advance
  2. If you set the Content-type to 'application/msword' a browser will recognize your page as a word document, so word will be started with your document (if it's registered correctly on the pc). Then you only have to take care of the contents. You can use HTML or RTF or some other document format to do the contents.

  3. Thanks Klaas

    but that is precisely where ,i am stuck up.

    setting the Content-type to 'application/msword' ,i am able to read a word document and wirte a string array ,or byte array.
    but i have to display a table ,full of contents in it ,and also while doing so ,i have to set the foreground color ,background color ,font etc....that to ,all this in a .doc file.
    if u have ritten something about will be very nice if u tell me in more details ,how to go about it

  4. You could start by just saving a sample document as .rtf and open it in a text editor.

    Take a look at M$'s RTF Specification:

    This is a hello world example:
    {\f0\froman Times New Roman;}
    {\i Hello}{\b World}!

  5. Hi Klass

    Thanks for this link ,i am going through it .
    Presently i am able to write a string on the word document ,but i need to draw table on it .do if u could please tell me how to go about it ?

  6. Hi Shubhangi.. how u write string to a word document.. past days im trying for that only.. i can read WordFile contents using POI API.. if u can pls send the code to write a string to Word Document... thanx in advance neha
  7. How to write a string to Word Document[ Go to top ]

    Hi sush s,

    Please can you tell me how to display the word file data in browser, no priority to show the html formats like background color,fore color, tables ... etc, please give me the solution, it is very very very urgent and so important for me........