function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sai ramsai ram 

how to generate rtf file from apex or visualforce page

how to generate rtf file from apex class and vf page
ShirishaShirisha (Salesforce Developers) 
Hi Sai,

Greetings!

Salesforce's Rich Text fields are encoded in HTML, not RTF, so the system itself is not going to help you here.

Inasmuch as designing an RTF parser in Apex is likely to be prohibitively complex and limited in functionality, your best course is probably going to be
Saving the RTF blob as an Attachment or ContentDocument in Salesforce.
Using something like rtf.js  to render the RTF file dynamically in a Visualforce page.

Alternately, you could implement a web service off-Salesforce (on Heroku, for example) to ingest the RTF and convert it to a more palatable format, like HTML or PDF, and re-inject that data into Salesforce.

Kindly mark it as best answer if it helps so that it can help others in the future.

Warm Regards,
Shirisha Pathuri