1. Kelvin Doan
  2. PowerBuilder
  3. Friday, 4 November 2022 14:07 PM UTC

I have a MS word document which contains words and images. I just want to display the whole document on popup PB window for user to read it. I created the window and RichText datawindow with one column as String with length 100 (it does not have Blob type on RichText data window) , and property is  "display only". On the open event of window , I put the code as : 

nteger rtn
rtn = dw_1.InsertDocument("c:\Documents\Richtextfile.doc", &
false, FileTypeDoc!)

When I ran it, nothing displays on Datawindow. Are there any ideas why the document did not show on data window. Thank you. 

Miguel Leeuwe Accepted Answer Pending Moderation
  1. Friday, 4 November 2022 14:27 PM UTC
  2. PowerBuilder
  3. # 1

Hi,

Try with a simple document first. Also try with an RTF file instead of DOC (DOCX?, why is that not mentioned in the help?).

This is what the help says:

 

Usage

When the control supports headers and footer (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.6 of the RTF standard, except for the following:

  • No support for formatted tables

  • No drawing controls

Any unsupported formatting is ignored.

 

Comment
  1. Andreas Mykonios
  2. Friday, 4 November 2022 15:01 PM UTC
Hi Chris.

From the IDE you can load a docx to a richtext datawindow control...

Of course, Kelvin doesn't mention what version of Powerbuilder is he using...

Andreas.
  1. Helpful
  1. Kelvin Doan
  2. Friday, 4 November 2022 15:35 PM UTC
Thank you. We use Powerbuider 2022 , I see the syntax of Insertdocument on Sybase has different types of file , that why I think I use FileTypeDoc! for msword document. Anyway , I tried to create the new rich text format with using different file type setup , it still does not display either.

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)
  1. Helpful
  1. Chris Pollach @Appeon
  2. Friday, 4 November 2022 16:03 PM UTC
Hi Guys;

The FileTypeDoc! argument refers to the old W95 MS-Word format (aka a .DOC file). The newer .DOCX format is not yet supported. So you would need to have the MS-Word software re-save the DOCX file as either a .DOC or .RTF file. Then use the InsertDocument() command into either the RTE control or an RTF based DWO.

HTH

Regards ... Chris
  1. Helpful
There are no comments made yet.
Andreas Mykonios Accepted Answer Pending Moderation
  1. Friday, 4 November 2022 14:55 PM UTC
  2. PowerBuilder
  3. # 2

Why don't you directly use a richtextedit control on your window? Based on what you described so far as a requirement, the datawindow isn't needed.

Andreas.

Comment
  1. Kelvin Doan
  2. Friday, 4 November 2022 16:00 PM UTC
Andreas, I'm not familiar with RichTextEdit control on PowerBuild. Could you tell me how to define it on Powerbuilder interface ? Can I open it on the PB window with using GetFileOpenName command ? Thanks.
  1. Helpful
  1. Miguel Leeuwe
  2. Friday, 4 November 2022 16:34 PM UTC
Hi Kelvin,

It's a control that you can paste on your window, just like you would do for a command button.
  1. Helpful
There are no comments made yet.
Kelvin Doan Accepted Answer Pending Moderation
  1. Friday, 4 November 2022 15:05 PM UTC
  2. PowerBuilder
  3. # 3

Thank you for your comment. I did create the new document (rtf file) with a few sentences (no image) for testing. Also I created the new RichText data window with datasource select as "external" and Retrieve on preview is checked, and Not checked "Header/Footer only" because document doesn't have footer/header, also I don't check  "Display only" because if I check this option I will get an error message "Cannot insert into RichText edit when Display Only property set true".  I did not see option to set clearflag (not sure I have to code like : set clearflag = true ???? ) . I use Powerbuilder 2022 .  Anyway, when I ran , the document still does not display on DWO. 

Comment
  1. Miguel Leeuwe
  2. Friday, 4 November 2022 16:32 PM UTC
Maybe this is not very helpful, but I've always avoided to use RT datawindow stuff, because it's always been very buggy. Whenever I need something I use a RTE CONTROL. Also not perfect but more reliable. It's a shame that in spite of all of the RT updates and upgrades, the powerbuilder function to insert a document still isn't aware of docX formats. Since RT is not a priority, I keep repeating that we should move away from the use of RichText and use HTML editors.
  1. Helpful
  1. Andreas Mykonios
  2. Monday, 7 November 2022 07:15 AM UTC
An html control would be welcome. But the major issues with such controls is that they are "tied" to 3rd party controls. Html is evolving which mean that you must be sure that the chosen control will also evolve and conform to updated specifications, and you also must provide those updates. In my opinion problems that may result may be similar with those related to webbrowser control. So its not an easy equation. Except if these control was part of the OS (like the old ie web control)...

In the past I did used a lot richtext datwindows with good results. But it was almost 20 years ago (and PB 6.5). In the meantime I did also worked with ole and word, which was a harder task but with good results.

In PB 2019 I used richtext control in a project to generate html from text. It was working but with lot of issues. Some time ago I've seen the following announcement from appeon: https://www.appeon.com/company/news/text-control-and-appeon-announce-expanded-partnership-enable-enterprise-document-processing-powerbuilder-users.html. I believe that this is expected in PB 2022R2, but I'm not sure what will be the real improvements that we developers will get.



Andreas.
  1. Helpful 1
  1. Miguel Leeuwe
  2. Monday, 7 November 2022 11:00 AM UTC
Hi Andreas I agree with you, but on the other hand, Appeon is also constantly telling us that the TXT control is a third party product. There has not been a single properly working version of the RTE for years now. They all have their own problems.

I'm not using TinyMCE myself (yet), though i would like to, but management is management. What I don't like of tinymce and similar solutions is all the JS and HTML that have to be added. True that a product like TinyMCE is third party, but the advantage is that you can pick any other similar editor. With the Appeon 3d party control, we're hostages of what they feed us.

  1. Helpful
There are no comments made yet.
Andreas Mykonios Accepted Answer Pending Moderation
  1. Monday, 7 November 2022 07:20 AM UTC
  2. PowerBuilder
  3. # 4

To add a richtextedit control to a window you simply select the control from the toolbar and click in the window designer at the position you want to place it.

Andreas.

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.