473,326 Members | 2,110 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Open, modify and save a microsoft word document in a jsp

Hello

I am trying the following problem:

A web app in jsp and java has to open a microsoft word document directly in the browser. This part is easy and i have done it.

The user then can modify the word document.

If the user 'save' the document (using the Save button of the MS tool bar in the browser) the application has to 'save as' the document on the server, not over writing the openned file but creating a new one.

I have just found documentation as how to do this in vbscript (http://www.daniweb.com/tutorials/tutorial51307.html and http://msdn.microsoft.com/msdnmag/issues/01/02/web/), but i am not sure if this vbscript can be ejecuted in a jsp server. And, primarily, i´d prefer to do it using Java-Javascript.

My basic idea was to add an unload event in the word page and then post the word content to a servlet and there to write it to a new file. The problem is that the opened word is not a jsp page and so it hasn´t events (unload, load, deactivate,...) and i don´t know how to approach this problem.

Any guides or ideas as to how to aproach it are welcome!!!
Apr 24 '07 #1
2 15312
I have this code:

Expand|Select|Wrap|Line Numbers
  1. function loadworddoc(){
  2.   doc = new ActiveXObject("Word.Application"); // creates the word object
  3.   doc.Visible=true; // display Word window
  4.   doc.Documents.Open("C:\\nuevo.doc"); // specify path to document             
  5. }
  6.  
My problem is how to detect the quit event when the user close the word document. Or especifically how to detect a document_before_close or similar event. The idea is in these event to read the document.content.

Any ideas as to how to detect the event??
Apr 25 '07 #2
If someone face the same problem i have solved it doing...

get scriptX in its web (google scriptX download and got it)
install it and add to the html, jsp,... page and

Expand|Select|Wrap|Line Numbers
  1.   doc = new ActiveXObject("Word.Application"); // creates the word object
  2.   doc.Visible=true; // display Word window
  3.  
  4.   doc.Documents.Open("C:\\nuevo.doc"); // specify path to document
  5.  
  6.   var sink = factory.NewEventSink(doc);
  7.   sink("DocumentBeforeSave") = onDocumentBeforeSave;
  8.   sink("DocumentBeforeClose") = onDocumentBeforeClose;
  9.  
write the functions onDocumentBeforeSave and onDocumentBeforeClose and do whatever you need-can on their.
Apr 25 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: lee_j | last post by:
Hi, I have a question below. In the Sql server 2000 I store some word documents.Then I get the data from the database through the asp code and display the word document in IE.The ContentType is...
3
by: Jon Paal | last post by:
any way to modify text content of a word document through ASP ?
1
by: Gary | last post by:
Hi, there, 1. I would like to open a word document in a MDI environment. Every time, a new window outside my MDI poped out and show the word document. Is there a method I can use to specify the...
2
by: terry | last post by:
I'm trying to figure out how open a microsoft word document from within an asp.net application. There is information in the web form that I need to merge with the opened document. I can't seem to...
1
by: JSL | last post by:
How to insert images into a Microsoft Word document using VB.NET?? my code: Public Function PictureReport() (it doesn't work!!!) On Error Resume Next Dim oDoc As Word.Document Dim range As...
1
by: mhsasono | last post by:
Hi all, Has anybody experienced with CrystalReport? My question is: Does CrystalReport have capability to print the Microsoft Word document? Reason: I want to know CrystalReport capability...
2
by: beemomo | last post by:
I have some invoice data on an MS Access form, and I wish to export the data into Microsoft Word document, can anyone help me please? Many thanks..
4
by: =?Utf-8?B?QXJ0?= | last post by:
Hello, I saw this posting and it is the closest place to ask this question. I am simply trying to create a Word document from a VB application I am wrting with Visual Studio 2005. I cut a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.