InsertDocument
PowerScript function
Description
Inserts a rich text format or plain text file into a RichTextEdit
control, DataWindow control, or DataStore object. The new content is added
in one of two ways:
-
The new content can be inserted at the insertion point.
-
The new content can replace all existing content.
Applies to
RichTextEdit controls, DataWindow controls, and DataStore
objects
Syntax
|
1 |
rtename.InsertDocument ( filename, clearflag { , filetype } ) |
|
Argument |
Description |
|---|---|
|
rtename |
The name of the RichTextEdit control, DataWindow control, |
|
filename |
A string whose value is the name of the file you want to |
|
clearflag |
A boolean value specifying whether the new file will
|
|
filetype (optional) |
A value of the FileType enumerated datatype specifying the
If filetype is not specified, PowerBuilder uses the |
Return value
Integer. Returns 1 if it succeeds and -1 if an error occurs. If any
argument’s value is null, InsertDocument returns null.
Usage
You cannot insert a document into a rich text control when the
control’s DisplayOnly property is set to true. If you try to do this,
PowerBuilder displays a runtime error message.
When the control supports headers and footers (the HeaderFooter
property is set to true), inserting a document can replace, but not add
to, existing header and footer text. You must set clearflag to true to
replace the existing header and footer text with header and footer text
from the inserted document.
Not all RTF formatting is supported. PowerBuilder supports version
1.2 of the RTF standard, except for the following:
-
No support for formatted tables
-
No drawing objects
Any unsupported formatting is ignored.
Examples
This example inserts a document into rte_1 and reports the return
value in a StaticText control:
|
1 2 3 4 |
integer rtn rtn = rte_1.InsertDocument("c:pb est.rtf", & TRUE, FileTypeRichText!) st_status.Text = String(rtn) |
See also