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

Display the content of the word document in a visual force Page

I need to display only the content of the word document in a visual force Page  and document will be in the contact record.


 i have the Custom Attachment button in contact details page  , when i click the that button the coresponding attachment content will show the Visual force page , I can retrieve the attachment via query and converted to string , but i cant assign body of the content in to visual force page,


any one help me for this???


can u refer any examples ?






public class AttachmentDownloadExtension
    public AttachmentDownloadExtension(ApexPages.StandardController controller) {


private Blob fileBody{get; set;}
public String str{get; set;}
private final Contact contact;
public String getstr()
return this.str;  
public Blob getFileBody()  
return this.fileBody;  
public void setFileBody(Blob fileBody) 
this.fileBody = fileBody;      

private ID contactid = ApexPages.currentPage().getParameters().get('id');

    public string AttachmentDownloadExtension(ApexPages.StandardController controller)
      Attachment[] attach = [Select body, bodyLength, ContentType, ParentId from Attachment where ParentId =: contactid ];   
      Blob b = attach[0].body;
      str = b.toString();
      return str;



As of now there is no way to inspect the contents of a word doc and place that directly into the page. You can try some the of the suggestions here:



Thanks ya



I tried your suggestions link , it was very useful for me  , but it cant be complete my requirement


I am searching.......... if u know anything more about ' Display attachment in visual force page ' send it me.