Submitted by Anonymous (not verified) on Thu, 09/01/2016 - 19:14


How do I place a word document in the IceBreak Response?



Niels Liisberg

Fri, 09/02/2016 - 10:45

Hi James,

VBscript is not the weapon of choice in modern web applications. Microsoft has (kind of) lost the browser battle. So for the same reason, do not use active-x components which is only supported in IE.

A much better and more cross browser friendly solution is direct serving the word document, and set the propper content type and disposition.

Basically your code looks like this:  

<%@ language="RPGLE"  %>
/* -----------------------------------------------------------------------------
* Program . . : include a word documnet
* ----------------------------------------------------------------------------- */
var msg     varchar(512)

  *INLR = *ON; 

  // let the browser-plugin have time to load the file

  // Word need this MIME type
    'application/vnd.openxmlformats-' +

  // What do we call it on the client, and should we download or show it in the broser window
  setHeader (
    'Content-Disposition' :
    'inline; filename="MyClientDocument.docx"'

  // Now get the payload
  msg = include ('myWordDoc.docx');

  // If error, sound the alarm
  if msg > '';
    %>Error opening document, reason: <%= msg %><%

Note: The document is read only, if you need to modify /save you need another technique. Textarea or web-dav. which is another ballgame..

Best regards,

Niels Liisberg