Try OpenEdge Now
skip to main content
ABL Data Types Addenda
Using large objects in ABL : Using BLOB values and word processor files
 

Using BLOB values and word processor files

This example assumes that there is a new field (called Report) in the customer table that contains a large MS-Word document. If this field contained an Excel spreadsheet instead of a Word document, the code to retrieve the data would not be different; only the display code would change:
DEFINE VAR wordfile AS CHAR INIT "filename".
DEFINE VAR hWordApp AS COM-HANDLE.
FIND FIRST customer.
/*Create a temporary file to hold the Word Document */
wordFile = SESSION:TEMP-DIRECTORY + "\"
+ customer.NAME + ".doc".
/* Copy the image from the blob field to the
* temporary file with COPY-LOB code */
COPY-LOB customer.Report TO FILE wordFile.
/* Display the Word Document */
CREATE "Word.Application" hWordApp.
hWordApp:VISIBLE = TRUE.
hWordApp:documents:OPEN(wordFile).