1. Louis Mancini
  2. PowerBuilder
  3. Wednesday, 23 October 2019 21:20 PM UTC

I have html in a column in a sql table and need to display it with all its formatting in a RTE control that I'm using to generate a RTF word document.

 

Is this possible?  Any ideas?

 

Thanks,

Lou

Louis Mancini Accepted Answer Pending Moderation
  1. Wednesday, 8 January 2020 22:41 PM UTC
  2. PowerBuilder
  3. # 1

Hi ,

 

thanks I was able to use InsertDocument and open the html doc in a RTE control and see all the formatting which is great.

 

but the fonts are way to large.

 

Is it possible using powerscript to select all text in a RTE and change the font size?  I cant seem to get it to work.

 

Thanks,

Lou

 

 

 

 

Comment
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Wednesday, 23 October 2019 22:22 PM UTC
  2. PowerBuilder
  3. # 2

Ah, forgot to mention this:

If you have the html in a table, then first save it to disk and then use the InsertDocument() function.

Comment
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Wednesday, 23 October 2019 22:20 PM UTC
  2. PowerBuilder
  3. # 3

Try using InsertDocument from code, or enable the "popup menu" on the RTE (on the "Document" tabpage), that last action will give you a contextual menu with an Insert File option which allows HTML.

I'm not sure if everything (like images) will show correctly if they are embedded or external links. If that doesn't work, then from code, save your html as RTF format in a file and then open the rtf and select all and copy and paste on the RTE control.

Just an idea.

Powerbuilder Help

psrefp560.htmpsrefp562.htm

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
rtename.InsertDocument ( filename, clearflag { , filetype } )

 

Argument

Description

rtename

The name of the RichTextEdit control, DataWindow control, or DataStore object in which you want to display the file. The DataWindow object in the DataWindow control (or DataStore) must be a RichTextEdit DataWindow.

filename

A string whose value is the name of the file you want to display in the RichTextEdit control. Filename can include the file's path.

clearflag

A boolean value specifying whether the new file will replace the current contents of the control. Values are:

•true – Replace the current contents with the file


•false – Insert the file into the existing contents at the insertion point

 

filetype
(optional)

A value of the FileType enumerated datatype specifying the type of file being opened. Values are:

•FileTypeRichText! – (Default) The file being opened is in rich text format (RTF)


•FileTypeText! – The file being opened is plain ASCII text (TXT)


•FileTypeHTML! – The file being opened is in HTML format (HTM or HTML)


•FileTypeDoc! – The file being opened is in Microsoft Word format (DOC)


If filetype is not specified, PowerBuilder uses the filename extension to decide whether to read the file as rich text or plain text. If the extension is not one of the supported file type extensions, PowerBuilder attempts to read the file as rich text. To insert files with extensions such as INI, LOG, or SQL, you must specify FileTypeText!.

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:
integer rtn
rtn = rte_1.InsertDocument("c:\pb\test.rtf", &
TRUE, FileTypeRichText!)
st_status.Text = String(rtn)

See Also

•InputFieldInsert


•InsertPicture


•DataSource

 

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.