Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS Word and COM

Status
Not open for further replies.

mThomas

Instructor
May 3, 2001
404
0
0
US

I have a project where users will need to open a Word document inside a browser. The users opening the Word document will allow/set IE to open Word in a browser. I figured using com would be the way to go.

I have a Windows server where I installed PHP 5.2.11. I have been able to write php scripts, however opening a Word document is driving me nuts.

I am getting a 500 error when I try the following code copied from php.net:

<?PHP

$word = new COM("word.application") or die("Unable to instantiate Word");

?>

The users will need to be able to open an existing Word document. Edit the document and then save it all within a broswer. The reason is the project must be HIPAA compliant and having the Word document opened in Word on a users computer presents HIPAA issues.

So, the main questions is, Can I open a Word document on a server running Windows 2008 64bit?

Can this be done?

Why is the above code producing an error? Is it because I do not have Word installed on the server?

Is there a setting in the PHP.ini file I need to set to allow IE to render a more detailed error report, sort of like debug="true"?

I've tried all sorts of various ways I've seen posted, most of which use the above code in some fashion.

Any help is appreciated.

mike
 
now that is quite odd. although i assume it's your web service that actually times out.

anyway, try running it from the command line instead. typically this should work

Code:
c:> c:\path\to\php.exe "c:\path\to\script.php"
 
also try loading up word manually to start with, so that the app is already in memory when php tries to bind to an instance.
 
As you running on a server don't set visible to true as it has no where to display to !
Code:
<?php
$word->visible = false;
sleep (300);
?>
Can I just clarify what your trying to do ?
You are trying to get an existing word doc from a server and make word open it via the browser. Does it need to be embedded in the browser? or a free standing copy of word?
What happens next?, does the user have the option of saving the doc back to the server ?
If you want to save the doc back from word I think you will have big issues there, you might want to look at web dav protocol (which is how sharepoint does it).
So I'm a little confused at what manipulation you want to do on the server to the doc.
 
ingresman
i believe that the OP has local access to the server. and thus setting wd to visible is a sound test to see whether it is instantiating properly.
 

Yes, I am trying to get an existing word document to open in a browser. I understand that the file type needs to be changed so the document will open in IE.

The document needs to be embedded in a browser.

With visible to true or false, Word open or not, here is what I get:

Fatal error: Maximum execution time of 300 seconds exceeded in D:\domain.com\jpadie.php on line 13

Once the document is open, the user can edit it (transcribe) and then save the document.
 
How do you intend to save it back ?
Do you time out with visible set to false (you said in a previous post that it worked then as you got the version out if - where did this display ?)
 
forgot to ask, are you serving up from IIS (version ?) or Apache ?
 
Currently my client uses a servcie called scribe.com. My client uploads a Word dcoument. The transcriber, through the scribe system, opens the Word document which displays in the browser with controls one of which is to save the document.

Whe I just have the new com the version is displayed in the browser screen.
 
It is a windows server with IIS. I have IIS 6, but do not use it. The Office is a trial version of Office Smal Business.
 
the time out occurs because of the word loading process (I suspect).

as advised above, creating a manual instance of word first might help speed the process.
 
By creating a manual instance of word you mean opening a word document on the server? if so I have done that, and whether Word is open or not the result is the same.
 
Looking at scribe.com it does not require word to be installed. Would I be correct in thinking that scribe doesn't actualy display the word doc, it extracts the bit it needs and displays it to the end users browser. They then change it, and save it back to the web server. The web server than updates the .doc file ?You say you have tne new com version, is that what your trying to get to work ?
 
The process is a Word dcoument is uploaded to the scribe system. A transcriber accesses the word document through a user backend. If the user has not associated IE with the .doc file type, then the word document opens in Word and not within the browser, other wise with the correct file association, the Word document opens inside the browser. There are buttons to save the document and do other functions, such as flag the document for review.

I want to emulate, at worst and duplicate at best the ability to manipulate a Word document via a browser.

The process must be HIPAA compliant, which in part means the dcoument can not be on the transcribers system. Of course the transcriber can copy the document and save a copy to their system, but the process must be where the document is on the server.

If I can upload a Word document, and the transcriber can "open" the document through a browser and then save it, whether the document is actually opened or the bits and pieces are manipulated and then the "file" is saved as a word document is a possibility.

Uploading as a Word document might not even be necessary. I could create a way for an applicaiton administrator to create a form.

The transcriber accesses the form.

The transcriber fill in the ncessary data.

The form is then saved as a Word document.
 
If you wanted to manipulate the word doc in the browser you proabbly could do that but would require the browser (for each user) to allow unsafe active-x to run and then manipulate via Javascript. In this case you don't require any word software on the server.
I would think that scribe must be using webdav to save word doc back to the server. It may run some JS (same caveat as above for the active-x) to read the doc file and send it back to the server via some kind of post request, which sounds really messy.
I must admuit I'm still cnfused as you are talking about server side functionality (i.e. the PHP) and client side i.e the browser, which are two very distinct environments.
You also talk of the user backend - what's that ?
 
The backend is where the transcriber will login to a website. He or she wil then be taken to their "backend" where they will see links to the audio files he or she is going to transcribe. The transcriber will select an aduio file. The transcriber will then select the appropriate Word document to use for the transcription. The transcriber will then transcribe the audio file into the Word document. The word document is then saved.
 
As I've said I don't know how word is saved back from a browser (without a load of hacking) and I'm confused about what word on the client is doing and word on the server is doing.
Sorry I think I'm going to have to back out on this one until I understand what it is your actualy trying to do.
 
the work flow, i believe, is this (I designed and implemented this for a solicitors practice 12 or so years ago)

1. doctor dictates some notes.
2. wanting them typed up, doctor uploads the notes wav to a site.
3. the site auto-processes the dictation using voice-recog; stores the processed text and alerts an audio typist
4. audio typist calls up text and listens to the 'dictation' whilst making corrections.
5. corrections made, the work flow pings back to the doctor to check his text.
6. the text can be altered by the doctor or sent back to the audio typist for quality control.
7. the text can be locked by the doctor as 'accepted'.
8. it can then be output/downloaded as a word document (or something else) for some other use/hard copy whatever.

if this is the case, then i would honestly (really really really) go with a js wysiwyg editor for all steps other than 8. the web is not built for heavyweight client apps like word to have direct interaction. use something lightweight and totally mobile/portable and just allow different outputs.
 
The process you have described is similar but there are some exceptions.

The doctors dictates into a telephone with various prompts to select type of form to use, and the ability to rewind, fast forward etc... The doctor then can select to start an additional dictation passing through the same menuing system. Once the doctor has completed the dictation session, the doctor is given a completion ID.

The audio file is saved to a hipaa compliant network. I am using VodaPlex, but there are numerous hosts Nuvox is another provider. There are many.

The transcriber (audio typist) accesses the audio files through a secure socket connection on a remote server. The audio files are accessed. The transcriber then within the same system he or she accesses the audio file (i.e. their backend) selects the correct medical form to use for the transcription.

While it is possible to use dynamic auto-processing, even today the voice recognition is not up to the kind of issues one deals with when transcribing the iflections and voice characteristics of multi-cultural doctors speaking in medical terms.

The error rate is high. Transcribers do it with greater precsion and in totality with greater efficency.

Once the transcriber is done with the transcription, the file (Word document) is saved to the file system and other things happen to the document dependent on what is supposed to happen based on parameters wet within each users settings. Some transcriptions get auto faxed, some a notification is sent to a medical records office, etc...

It is selecting that form, displaying it in an editable format and the being able to save the edited document is what I'm trying to do. The uploaded document (like a blank patient addmissions template) can be in Word or some other format, the document must be editable via a browser and then saved in Word format.

 
we found that a combination of voice recog and audio typists was efficient. but legal audio typing tends to be letters and riders. and the language used is very precise, allowing for unrecognised words to be guessed at through grammar rules as well as spelling rules.

on your issue: i would model each form onto a webform so that data is stored in a non-word format. then force a mailmerge with a pdf or word version of the form only once the text is totally accepted. the concept of manipulating MS Word documents directly on line does not seem sensible unless you are using a whole bespoke, professionally designed sharepoint installation.

infopath might also be a solution to look at, now that i think about sharepoint and other paid for technologies.

 
I'm still trying to build a solution. I have found an Active X which will work, Ultra Office, however, the more I think about it the more I like the idea of a rich text editor and saving the file as a word doc when necessary.

Can the editor jpadie posted a link to be modified to open an existing file? If so how?

tia...mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top