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
bp-devbp-dev 

Parsing an RTF Doc

So I'm wondering if this is possible in SF. Say I upload an rtf file (not UTF-8 encoded) to docs. Then I'd like to be able to pick up that file (probably via apex) and get some stats from it. Let's say something simple like a word count. Is that possible?

 

I know that with a UTF-8 encoded file and the doc.body.toString() method I can get the actual string content, but is there something I can do for a regular rtf file with ANSI encoding? Ideally I'd like to get it to a place where I can actually tell where paragraphs begin and end, get other properties like color of text, etc, but let's start with word count.