Performing Print, File, and Clipboard Operations

The WEB-BROWSER control includes special properties that allow users to perform standard Windows print, file, and clipboard operations from your COBOL application.

There are five special properties relating to the Windows Print function. They are designed to let users print the contents of the WEB-BROWSER control (i.e., the Web page that is being displayed). These are:

Special Property Function
PRINT Displays the "Print" dialog
PRINT-NO-PROMPT Prints without displaying a dialog first
PRINT-PREVIEW Displays the "Print Preview" dialog
CUSTOM-PRINT-TEMPLATE Defines the name and location of the custom template to use for printing and print previewing. (For use with IE versions 5.5 and later)
PAGE SETUP Displays the "Page Setup" dialog

To display the "Print" dialog so that users can choose a printer, page range, and so on, set the Print property equal to "1" as such:

display web-browser PRINT = 1.

To assign a custom print template to use when printing with the dialog, add a pathname to the CUSTOM-PRINT-TEMPLATE property, then set PRINT equal to "1". For example:

display web-browser CUSTOM-PRINT-TEMPLATE = " \templates\mytemplate.html", PRINT = 1.

In addition to the print properties, the WEB-BROWSER control has several special properties relating to the Windows file and clipboard operations. These are:

Special Property Function
COPY-SELECTION Copies current selection to clipboard
CLEAR-SELECTION Clears current selection from clipboard
SELECT-ALL Selects the active HTML page, frame, or entry field, depending on cursor location
SAVE-AS Displays the "Save As" dialog
SAVE-AS-NO-PROMPT Saves frame contents to disk without prompting (for early version of IE only)
FILE-NAME Defines path of file to be used in Save As operation
PROPERTIES Displays the "Properties" dialog

To copy the current selection to the clipboard, set the COPY-SELECTION property to "1" as shown below:

display web-browser, COPY-SELECTION = 1.

For complete information on the WEB-BROWSER control special properties, see Web Browser