CreateComObjectFromFile - DFComDocumentObject
Creates a new document and initializes it with data read in from the file passed in the sFile parameter
Type: Procedure
Parameters
| Parameter | Type | Description |
|---|---|---|
| sFile | String | The file name |
Syntax
Procedure CreateComObjectFromFile String sFile
Call Example
Send CreateComObjectFromFile sFile
Description
The CreateComObjectFromFile message is sent to create a new document and initialize it with data read in from the file passed in the sFile parameter.
The embedded object wrapper class determines the type of document that is created.
The file name passes in the sFile parameter must be of a format that is understood by the OLE server application that is associated with the embedded object you are creating.
The example below demonstrates the use of CreateComObjectFromFile to choose a file, create a new MS Word 8 document and read the selected file into the new document.
Procedure OnClick
String sFileName
Boolean bIsCreated
// only create a new document If we are Not already attached
// to one.
Get IsComObjectCreated of oWordDocument To bIsCreated
If (Not(bIsCreated)) Begin
// Use the open file dialog to Get the filename we
// wish to open.
If (Show_Dialog(oOpen_dlg)) Begin
Get File_Name of oOpen_dlg To sFileName
Send CreateComObjectFromFile of oWordDocument sFileName
End
End
End_Procedure