WPCubed Product Support

Saving all wprichtext to string

I have been using:

Fields[0].asString := WPRichText.BodyText.RTFText.asString;

to save richtext to a database. But I now need to add headers and footers. This does not save that information. Is there a way to get teh Header, Body and Footer al from a similar call? This works well because it saves images in teh richtext as wellas the text. Will need to do the same with all regions.

#1 ♥ 0
3.3k Views 2 users read 1 min
support

Hi,

to save richtext to a database. But I now need to add headers and footers. This does not save that information. Is there a way to get teh Header, Body and Footer al from a similar call? This works well because it saves images in teh richtext as wellas the text. Will need to do the same with all regions.

To save all text (body and header) use

Fields[0].asString := WPRichText.AsANSIString('RTF');

To save the header and footer and body into seperate strings use your code but over a loop of the elements of

WPRichText.HeaderFooter

For example

for i:=0 to WPRichText-HeaderFoouter.Count-1 do
begin
   if WPRichText.HeaderFooter[i].Kind in [wpIsBody, wpIsHeader, wpIsFooter] do
  begin
      Fields[xxx].asString := WPRichText.HeaderFooter[i].RTFText.asString; 
  end;
end;

Regards,
Julian

#2 ♥ 0
This category is archived. No new posts are possible.