Answered Opening and feeding a MS document

K4sh

Member
Hello there,

I'm actually trying to open a MS Word document in my Webspeed application and cannot figure it how.

What i would try to do is to open a .dot or .dotx document and to feed it with informations retrieved from my database.
Any clue how to do it ?
 

Rob Fitzpatrick

ProgressTalk.com Sponsor
A .dot or .dotx is a template, not a document. So your actual requirement is to create a new document from a template, rather than open an existing document.

This is a basic outline of how to use a Word template. It is not production-grade code. I have not tested it in WebSpeed.

In this case I assume your WebSpeed agents run on Windows and Word is installed on that machine.

Code:
/* this is basic sample code only */
DEFINE VARIABLE chWord AS COM-HANDLE NO-UNDO.
 
CREATE "word.application" chWord NO-ERROR.
 
chWord:Documents:ADD("C:\test\test.dotx").
 
/* add data to the file here and save it as a document. */
 
chWord:QUIT.
 
RELEASE OBJECT chWord.

Or are you actually trying to create a template?
 

K4sh

Member
Thank you for your reply,
I'm not trying to create a template but to fill it with informations from database.
I would like also to open it (into browser or Word) with the whole document fullfilled so that the user can have a look at it and record it if wanted.
I will give a try with your solution though i'm not sure it can works with Webspeed.
 

Cringer

ProgressTalk.com Moderator
Staff member
Please provide the full error message rather than a guess of it so that people can help you out.
 

Rob Fitzpatrick

ProgressTalk.com Sponsor
Thank you for your reply,
I'm not trying to create a template but to fill it with informations from database.
I would like also to open it (into browser or Word) with the whole document fullfilled so that the user can have a look at it and record it if wanted.
I will give a try with your solution though i'm not sure it can works with Webspeed.

If you want document display and editing rather than document generation, that's a different problem. For an end user who is using your WebSpeed application in a browser, how do you plan to host Word inside of it and edit a document? And you won't be launching Word on their machine as your code runs on the WebSpeed transaction server. I don't understand your intended design.
 

K4sh

Member
All i wanted to do is to be able (client side) to open a word template document (server side if possible) to fullfill it with informations retrieved from database and to open it into Word (client side). I know it's possible to launch Word from webspeed application.
I found easily a source code to be able to do this but it's php technology.
Looks like it's really hard to find examples for webspeed tech anywhere the web :( .
 

Cringer

ProgressTalk.com Moderator
Staff member
Webspeed code runs on the server and essentially generates code that the browser can display to the user. If you open a Word doc in Webspeed it would be opening it on the machine the webspeed broker resides on, and not on the client PC. You could use Webspeed to generate code that runs on the client by generating, say Javascript code with the data you require embedded into it. I've done that sort of thing before, many moons ago and it's quite possible.
 

K4sh

Member
Ok forget about my question. My manager asked me to do it not using speedscript. So it may be any tech that can be called from webspeed.
 
Top