3

I know we can search for within a Word content file in Salesforce using SOSL. But reading the VersionData field of ContentVersion returns a Blob which is not UTF-8 format content, so we could not convert it into a text string within APEX.

I'm looking for any way to achieve the objective of reading a Content file (MS Word) document into a test stream.

Is this is not possible natively within platform, does anyone knows of any REST API services that offer this function?

3
  • .doc or..docx? The latter should be a parseable (more-or-less) XML file. Jun 22, 2019 at 18:46
  • zipped XML, I mean. Jun 22, 2019 at 19:01
  • No it doesn't read them into string. I tried that in apex. We get Blob is not a valid utf-8 string when we try to read it in Apex (for Doc/Docx files)
    – VarunC
    Jun 22, 2019 at 20:29

1 Answer 1

4

In Apex, it's not a trivial thing to read .doc files. I use javascript libraries to do it. Here is one of the tools that I use:

https://docxtemplater.readthedocs.io/en/latest/installation.html#browser

It does an ok job.

3
  • Sadly, my use case involves strictly an automation supportive approach, without a UI element and javascript is not useful in that approach.
    – VarunC
    Jun 22, 2019 at 20:30
  • Got it.... why is business asking for this feature? Jun 23, 2019 at 0:31
  • Process Builder automation is involved in this approach.
    – VarunC
    Jun 23, 2019 at 8:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .