TWPRichText.SaveToString ?

  • Hello,

    I'm using a TWPRichText as a memo-field and the RTF is stored in a BlobField in the database. It's also a string-property in a business-object I have created! I'm using BlobField.AsString to set and get the RTF en put it in the business-object. To put it from the business-object in the TWPRichtext I use the LoadFromString. To get the RTF from the TWPRichText I would like to use SaveToString. But there is no SaveToString. Why not?
    Now I have to use SaveToStream to put the RTF in a memorystream, load the memorystream in a TStringlist and then I can use the Text property to get the RTF-string I need.

    Is there an easy way to achieve the SaveToString I need with TWPRichtext directly?

    TIA

    • Offizieller Beitrag

    Hi,

    Please use the method

    AsANSIString

    it actually does the "SaveToString" functionality. In contrast to the also available AsString property (read and write) You can pass the format string i.e. 'HTML' as optional parameter.

    Julian

  • Zitat von wpsupport

    Hi,

    Please use the method

    AsANSIString

    it actually does the "SaveToString" functionality. In contrast to the also available AsString property (read and write) You can pass the format string i.e. 'HTML' as optional parameter.

    Julian

    Hi Julian,

    I tried AsANSIString before and it only resulted in the text. I didn't know I could use the FormatName-parameter. Now I'm using AsAnsiString('RTF') and it's working fine.

    Thanks,

    Ronald