Previous Topic: Accessing Web Option Through Another Website

Next Topic: Adding Field-Specific Help Buttons

Calling PC Programs from Web Option (Such as MS Word, MS Excel)

Depending on your needs, calling a PC application such as MS Word can be as simple as navigating between HTML pages.

In general, an application such as MS Word has a document suffix associated with it (for example, .doc for Word documents and .xls for MS Excel spreadsheets). Specifying a link to an object with one of these suffixes, therefore, loads that document into the browser window. The document displays exactly as it would in the given application; it cannot be edited in this format.

There is a function called LOAD within the YSCRIPT.JS default JavaScript file in Web Option. Calling this function (passing the IBM i name and a document name) opens a new browser window and loads the specified document, by concatenating “http://”, the passed IBM i name, “/WEB2EDOC/” and the document name. When this new window is closed, control passes back to the original window.

For instance, if you have a Word document called USERDOC.DOC in the Y2WEBDOC folder within QDLS on your IBM i, you could add the following HTML to a page to display that document:

<INPUT TYPE=”BUTTON” VALUE=”Display User Doc” onClick=”LOAD('myas400','userdoc.doc')”>

When the button is clicked, a new window opens with the following url:

http://myas400/WEB2EDOC/userdoc.doc

Although the LOAD function explicitly assumes the document is in Y2WEBDOC (for which the external name is WEB2EDOC), you can change the LOAD function to retrieve documents from other locations. The source for the LOAD function (in YSCRIPT.JS) is:


function LOAD(as400,doc)

 new_win = window.open("http://" + as400 + "/WEB2EDOC/" + doc,
     "New_window",                         'menubar=no,toolbar=no,location=no,resizable=yes');
 new_win.focus();
}

However, you can change this (if you are familiar with JavaScript) to perform document-specific checking, perhaps by loading documents from subfolders within Y2WEBDOC for specific document types.

Using a hyperlink is a simpler method of loading a PC document into a separate window, as in the following HTML example:

<HTML>

Click <A HREF=”/WEB2EDOC/userdoc.doc” target=”_blank”>here</A> to see the user documentation.

</HTML>

When the word here is selected in the previous HTML section, a MS Word Document comes up.