Ms word?

seductive

Member
hello, i have a problem about MS WORD. how to open a MS WORD document in webspeed?
i want to pass a parameter so that it will view in the document.. help me.. thanks in advance.. :D
 

lee.bourne

Member
Hi,

Do you want the Word document to appear in the browser? I'm assuming it's stored on the server already? If so the code below should work. You can switch the word 'inline' for 'attachment' if you want it to fully launch Word rather than embed the document in the browser.

Regards,

Lee


output-http-header ("Content-disposition":U, "inline; filename=yourwordfile.doc":U).
output-content-type ("application/msword":U).
RUN StreamFile (INPUT "yourwordfile.doc":U).

PROCEDURE StreamFile :
/*------------------------------------------------------------------
(c) 2000 Bob Mirro. All rights reserved. Permission
given to the Free Framework to distribute
freely so long as this copyright is kept
intact.

File Name: StreamFile.p
Author: Bob Mirro
Creation Date: 1999


Inputs Parameters: ip_filefullpath - full path name to the binary
file to be sent out to the
webstream.
Outputs Parameters: none


Program Purpose: This program takes a binary file and
send it out to the browser.

Design: Expect the full path name of the file, calling programs
can mess with search() and the like if they want
so it's not done here. Also be *VERY* careful - the
HTTP headers should be written out before this
program executes. This is constructed as a PROCEDURE
mean to be run persistantly with potential for
SUPER's. Implemented as a CGI wrapper as messing
with HTTP headers and raw data is best done directly
in the 4GL.

Modification History: 08/03/00 GC - took original program
and wrote comments for submission
to FFW.
-------------------------------------------------------------------*/

DEFINE INPUT PARAM ip_filefullpath AS CHARACTER NO-UNDO.

DEFINE VARIABLE vfileline AS RAW NO-UNDO.

/* Must use the Binary qualifier here to prevent code page
translations on the way in. */

IF (SEARCH(ip_filefullpath) EQ ?) THEN
RETURN.

INPUT STREAM inputfile FROM VALUE(ip_filefullpath) BINARY NO-ECHO.

/* Read the file in 1024 byte chunks. Input must be UNFORMATTED
in order to read the binary codes. Output directly to the
browser with using the WEBSTREAM pre-processor. PUT must also
use CONTROL to prevent code page translations on the way out. */

REPEAT:
LENGTH(vfileline) = 1024.
IMPORT STREAM inputfile UNFORMATTED vfileline.
PUT {&WEBSTREAM} CONTROL vfileline.
END. /* repeat */

/* Clean-up: Raw variable should be reset to deallocate the memory
and the stream should be closed. */

LENGTH(vfileline) = 0.

INPUT STREAM inputfile CLOSE.

END PROCEDURE.
 
Top