473,769 Members | 3,232 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

6 New Member
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.h tml 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 15359
gusa992000
6 New Member
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.conten t.

Any ideas as to how to detect the event??
Apr 25 '07 #2
gusa992000
6 New Member
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 onDocumentBefor eSave and onDocumentBefor eClose 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
9020
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 "application/msword". My question is how to save the word document which is edited to the database. Thanks for your advice!
3
1978
by: Jon Paal | last post by:
any way to modify text content of a word document through ASP ?
1
13949
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 showing window? And how to? 2. Is there a way to preview the word document, other than load it fully? 3. How to extract all the characters in Unicode from this word document? Thanks lot in advance! Gary
2
1737
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 find any code examples or explanations on how this is done if it's even possible. Has anyone successfully accomplished this task or even tried and if so, how is it done?
1
5698
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 Word.Range
1
1817
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 since now I am in the middle of developing a system that generate a report or document from various resources, e.g. some parts are Oracle fields and some parts are text of microsoft word object. Thanks in advance.
2
3203
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
1993
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 pasted a simple routine within the 'click' sub-routine and I'm simple having a problem with resolving the statement 'Dim objWord As New Word.Application' where it is complaining about 'Word.Application' is not defined.
0
9590
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9424
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10051
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10000
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7413
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3968
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3571
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.