When to use refresh, reformatall, and changing

  • Using v5.23.6

    Here are some properties I have not always been sure when they should be used.

    When using the TWPRichText or the TDBWPRichText when should one be using the refresh, reformatall, and changing methods?

    And where is the best place to find answers like this. The help file doesn't always let you know when you should be using something.

    Greg

    • Offizieller Beitrag

    Hi,

    Refresh does not have to be called.

    ReformatAll must be called when you changed the character attributes directly (mdoify CharAttr index in paragraphs) or indirectly by changing a style. It is not required if you used the toolbar, CurrAttr and similar, because then the engine knows which lines have to be initialized.

    ReformatAll always have to be called if you change the text (load, MergeText ..) and do a Print or PDF output after that whithout giving the editor a chance to refresh itself.

    Changing must be called before you do a programmatic change of the text in a DBWPRichText. It returns false if thie text is meant to be readonly.

    Julian

  • Zitat von wpsupport

    Hi,
    ReformatAll must be called when you changed the character attributes directly (mdoify CharAttr index in paragraphs) or indirectly by changing a style. It is not required if you used the toolbar, CurrAttr and similar, because then the engine knows which lines have to be initialized.

    ReformatAll always have to be called if you change the text (load, MergeText ..) and do a Print or PDF output after that whithout giving the editor a chance to refresh itself.
    Julian

    1) So... if I populate the TWPRichText using the wprichtext.asString := afield.asString do I need to call ReformatAll?

    2) And should one be using the .asString or the .asAnsiString. Could you give a description of the differences and when one should be used verses the other.

    Thanks

  • Zitat von wpsupport

    1) - no, not required

    2) AsANSIString is a function and takes several parameters. The most important parameter is the "format string" which latest you select RTF, HTML or WPTOOLS and also additional options:
    https://www.wpcubed.com/manuals/formatstrings.htm

    Julian

    So when would one want to use AsANSIString verses AsString?

    For me I would guess we would always us AsString if the WPRichText component is doing all the editing loading and saving of data and not retrieving from any other external sources. I wouldn't see a reason to use AsANSIString since the WPRichText is handling the original creation and all editing of the content.

    Anyway... just wanting to understand when it would come into play where I would need it.