1. Aart Onkenhout
  2. PowerBuilder
  3. Friday, 15 September 2023 10:03 AM UTC

Hi,

I wonder if it's possible to load a blob into a richtextedit control At the moment we're using the activex version of the tx text control (so not the richtextedit control but an olecontrol based on the activex tx4ole30.ocx), in which we can use the loadfrommemory and savetomemory functions that are defined on that activex.We save our documents as a text column into a database table. With selectblob we get the contents back and can load it into the text control with the loadfrommemory function.

It seems those two functions are not implemented in the version that's integrated into powerbuilder. Is this correct or am i missing the appropriate functions (I'm afraid not).

Regards, Aart

Mark Goldsmith Accepted Answer Pending Moderation
  1. Friday, 15 September 2023 18:11 PM UTC
  2. PowerBuilder
  3. # 1

Hi Aart,

It sounds as though you would like to move away from using the OCX...have I got that right? If so, since the CopyRTF and PasteRTF are essentially the same as the loadfrommemory and savetomemory functions (albeit restricted to the RTF format), which is what Appeon has exposed in the RTF control, could you convert your existing data? The issue just seems to be that CopyRTF and PasteRTF only work with the RTF style whereas with the OCX you can choose the format upon saving/ reading (loading).

As you stated, you are currently using format 3 (choosing nothing will do the same) which uses the internal format not compatible with standard RTF. Have you tried using the RTF format number, which is 5? I understand this might mean creating a script to convert all your existing data from the internal format to the RTF standard, but then you should be able to work with it using the CopyRTF and PasteRTF functions and move away from the OCX.

HTH...regards,

Mark

Comment
  1. Miguel Leeuwe
  2. Friday, 15 September 2023 20:19 PM UTC
One by one, you load your data saved in format 3, then save it as format 5 (or you could use Html format too).

Then have a new RTE control (pb format) and use InsertDocument()..

If you'd have to convert a lot of data, I'd recommend to do some testing with it first.

I don't know which PB version you are using, but over the last 4/5 years we've gone through all of the different versions Appeon had to offer and not a single one was really bug free. There's new hope for the latest version in pb2022 r2, but already, pasted images, when saved as html, are a bit "blurry" and we still haven't fully test it. (staying on 2019 for now).

BTW: you did NOT say you were saving in format 3, until you told me that "you already told me you were saving in format 3". Maybe I'm going blind

:)
  1. Helpful
  1. Mark Goldsmith
  2. Friday, 15 September 2023 22:59 PM UTC
Actually Miguel, InsertDocument() would only be used if pulling a file from disk. I believe Aart is storing the content in the database and could continue to do so once the data is converted.

As for you going blind, lol, no I think you still have your eyesight. While Aart did previously mention using the internal format, which IS format 3, that was the first time he used "format number 3" and "internal format" together in the same reply ;)
  1. Helpful
  1. Miguel Leeuwe
  2. Saturday, 16 September 2023 04:50 AM UTC
Yes, that's correct. I mean ... it's just a matter of writing the blob to disk as a file after getting the content from the DB. I probably should have included that step before saying to use InsertDocument().

regards

  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Friday, 15 September 2023 14:51 PM UTC
  2. PowerBuilder
  3. # 2

Hi Aart;

  Have you thought about using a TableBlob based DataWindow! For example ...

1) Create a Table with a large text / blob column. For example:

2) Create a FreeForm DWO.

3) Add a TableBlob column and map it as RTE...

Food for thought.

Regards ... Chris

Comment
  1. Aart Onkenhout
  2. Friday, 15 September 2023 15:57 PM UTC
What do you mean by 'load the RTE Control the long way from a file written after the SelectBLob command. '?



What I do right now is selectblob and load the blob into the tx text activex by using the loadfrommemory function. I think there's no way to write the blob to a file because of the format it's in. Or do you mean something else?



I actually think there's no other way right now but sending an enhancement request to Appeon to implement those two functions.
  1. Helpful
  1. Chris Pollach @Appeon
  2. Friday, 15 September 2023 18:16 PM UTC
By using the InsertDocument () method.
  1. Helpful
  1. Miguel Leeuwe
  2. Friday, 15 September 2023 20:11 PM UTC
Yes, but that (InsertDocument() ) probably won't work either if the format is not RTF or HTML ?

  1. Helpful
There are no comments made yet.
Aart Onkenhout Accepted Answer Pending Moderation
  1. Friday, 15 September 2023 14:01 PM UTC
  2. PowerBuilder
  3. # 3

Thank you for your answer, but as the (existing) documents are saved to the database by using the savetomemory function, converting it to a string isn't working, it doesn't look like rtf in any way (it's text control internal format).

Comment
  1. Miguel Leeuwe
  2. Friday, 15 September 2023 16:49 PM UTC
of course,

You still haven't answered in which format the blob is being saved.

regards
  1. Helpful
  1. Aart Onkenhout
  2. Friday, 15 September 2023 17:13 PM UTC
Well, as I said before :), we use tx control internal format (see https://www.textcontrol.com/documentation/?param=o_txtextcontrol.save.htm&product=ocx, format number 3).
  1. Helpful
  1. Chris Pollach @Appeon
  2. Friday, 15 September 2023 18:21 PM UTC
Unfortunately, the TX Control that Appeon is given is not as rich featured as the purchased control from the TextControl vendor. So we can only expose what that version and it's legal rights to use offer us.
  1. Helpful
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Friday, 15 September 2023 13:35 PM UTC
  2. PowerBuilder
  3. # 4

Hi,

You can:

- use the rte_1.CopyRTF(FALSE) function, convert the returned string to a blob and store in blob field in DB

- and then use rte_1.ClearAll(), SELECTBLOB, convert to string and PasteRTF() to assign back to RTE control

regards

 

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.