* Extracting long text fields, rich text, carriage returns etc

For users to report plugin bugs and request plugin enhancements; and for authors to test new/new versions of plugins, and to discuss plugin development (in the Programming Technicalities sub-forum). If you want advice on choosing or using a plugin, please ask in General Usage or an appropriate sub-forum.
Post Reply
User avatar
Talln
Gold
Posts: 18
Joined: 09 Feb 2021 17:15
Family Historian: V7
Location: London

Extracting long text fields, rich text, carriage returns etc

Post by Talln » 30 Mar 2022 14:13

Hi again - another API question...

I've had some fun trying to figure out how to extract long text fields, e.g. Notes or Text from Source, with all the html formatting in tact (or with known control char behaviour). These can either be rich text/embedded html or plain text with/without carriage returns.

Using fhGetItemText or fhGetDisplayText I seem to get cropped versions with all the paragraphs munged into a single unformatted text sentence.

This might be a LUA string handling artefact or the way the FH API returns the data in the way I've been using it.

Do you have to use the GetParagraph function ? What if a para is too long for the API ?

Can anyone provide a snippet of how it should be done please!

Thanks in anticipation!

Cheers
Paul
Paul Weaver, London

User avatar
Jane
Site Admin
Posts: 8441
Joined: 01 Nov 2002 15:00
Family Historian: V7
Location: Somerset, England
Contact:

Re: Extracting long text fields, rich text, carriage returns etc

Post by Jane » 30 Mar 2022 14:36

You need to create a Rich Text Object and pull the note into that.

See
https://www.family-historian.co.uk/help ... h_text.htm
and
https://www.family-historian.co.uk/help ... syntax.htm
in the plugin help.
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."

User avatar
tatewise
Megastar
Posts: 27082
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Extracting long text fields, rich text, carriage returns etc

Post by tatewise » 30 Mar 2022 14:45

Use the fhGetValueAsRichText(...) function to extract the Notes or Text from Source.
See https://www.family-historian.co.uk/help ... chtext.htm
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

User avatar
Talln
Gold
Posts: 18
Joined: 09 Feb 2021 17:15
Family Historian: V7
Location: London

Re: Extracting long text fields, rich text, carriage returns etc

Post by Talln » 30 Mar 2022 18:06

Thanks for the help. Will give it a go! :D
Paul Weaver, London

Post Reply