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
Bob DeRosierBob DeRosier 

text in document and display differ -where does the displayed text come from ?

The VF page 
<apex:inputTextarea id="waiver" value="{!waiver.Waiver_Text__c}" style="width: 600px" rows="10" disabled="true"/>

The controller
Waiver_Text__c = getWaiverText()

     private String getWaiverText(){
        // Get document from document, document name hard coded right now ... not long-term
        String docContent = 'Waiver text is missing; make sure there is a document with the UNIQUE NAME HAI_Global_Waiver.';
        List<Document> doc = [SELECT Id, Body from Document WHERE DeveloperName = 'HAI_Global_Waiver'];
            try {
                docContent = doc[0].Body.ToString();
            catch (Exception ex) {
                docContent = 'Error in loading waiver text. Check with the office or event registration desk.';
                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, 'SYSTEM ERROR: There was an error loading the waiver file, please contact the office.')); 
        return docContent;

When I check the SELECT statement, it produces a SF Object ID for a SF document and a body

The SF document has a location link for a Google doc which is similar to, but not the text displayed.  
I would appreciate any help to locate the actual text. 
Andy BoettcherAndy Boettcher

The body of a document is in Base64 - read through this board post and see if that helps you out:
Bob DeRosierBob DeRosier
the document claims to have a size of 0 bytes.   
Andy BoettcherAndy Boettcher
Did you check that after converting it?
Bob DeRosierBob DeRosier
I'm not quite sure what that means.  Are you telling me not to trust SF when it gives a size of 0 bytes for a document ?

Alternatively, I have a similar document defined in Sandbox and I can't get it to display anything as the above code throws errors.  The document uses the same URL for location as the production code and also has a size of 0 bytes.  How can I create a document that I can edit ?