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.
Controls
RichTextEdit controls, DataWindow controls, and DataStore
objects
Syntax
|
1 |
<span>rtename</span>.<span>InsertDocument</span> ( <span>filename</span>, <span>clearflag</span> { , <span>filetype</span> } ) |
|
Argument |
Description |
|---|---|
|
rtename |
The name of the RichTextEdit control, |
|
filename |
A string whose value is the name of the |
|
clearflag |
A boolean value specifying whether the
|
|
filetype |
A value of the FileType enumerated datatype
If filetype is not specified, PowerBuilder |
Return Values
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 |
integer rtn |
|
1 |
rtn = rte_1.<span>InsertDocument</span>("c:pb est.rtf", & |
|
1 |
TRUE, FileTypeRichText!) |
|
1 |
st_status.Text = String(rtn) |