Word Automation "InsertFile" Method fails with Insufficient Memory error

Project:Word Documents Created from OE
Component:Miscellaneous
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description

I have a Word Automation issue that I haven't been able to get past. Our client has roughly 4 to 5 pages of rich text stored in our Progress OE 10 database that we haven't been able to insert into a new Word document using the InsertFile method. The text contains no images, tables, etc., just rich text. The process is not new, and the same client has used it hundreds or maybe thousands of times for the same purpose. The text size approaches the largest text size in use, but doesn't appear to be the largest. The most recent change to the data was to add "a few words".

Our application "pieces together" a Word document from multiple fragments stored in our database. As such, there is no single place that all of the data to be exported to Word exists in the system. So, we export the sections into their own temporary .rtf file, and use the InsertFile method to insert the text fragment from the temp file into the "ultimate" Word document. I know that this sounds slow, but for the typically 20 to 80-page documents we produce this all happens in less than a minute, which is quite tolerable. It's never failed before.

Is it likely that the client PC is truly just out of memory? Multiple users have tested the data with the same result.

Simple code excerpt follows:

/******************************************************************/
/* sendtext-ip sends a rich text blob one 16kb section at a time. */
/******************************************************************/
PROCEDURE sendtext-ip:
DEF INPUT PARAM p-rtf-text AS RAW.

/* Get the next opsys file name. */
ASSIGN g-opsysfile = sys-osfile-fn(".rtf").

/* Dump the current section to an interim .rtf file. */
OUTPUT TO VALUE(g-opsysfile) NO-ECHO.
PUT CONTROL p-rtf-text.
PUT SKIP.
OUTPUT CLOSE.

/* chRange:InsertFile(g-opsysfile). */
chwordapplication:selection:InsertFile(g-opsysfile).
ASSIGN l-section-end = chwordapplication:selection:END
l-section-length = l-section-end - l-section-start + 1.

OS-DELETE VALUE(g-opsysfile).
END PROCEDURE. /* sendtext-ip */