You need to sign in to do that
Don't have an account?
I have a doc type attachment stored in salesforce. I want to show the content of that file on vf page, Is there any way to display doc or docx file type content on vf page?
my vf page is
<apex:page controller="showAttach" renderAs="">
<apex:form >
<apex:pageBlock mode="maindetail">
<apex:outputLabel escape="false" value = "{!attachBody}"></apex:outputLabel>
</apex:pageBlock>
</apex:form>
</apex:page>
controller is
public class showAttach{
public transient String attachBody{get; set;}
public showAttach() {
String str =ApexPages.currentPage().getParameters().get('id');
Attachment att =[SELECT Name,Id,Body FROM Attachment where Id = :str LIMIT 1];
transient blob b = att.body;
attachBody= EncodingUtil.base64Encode(b);
insert d;
}
}
For a PDF see the link below,
Embedding a PDF using HTML markup
http://pdfobject.com/markup/index.php
See the below thread for similar discussion,
https://developer.salesforce.com/forums/ForumsMain?id=906F000000096zkIAA
Try this,
<embed src="{!URLFOR($Action.Attachment.Download, worksheet.Attachments[0].Id)}" style="width:100%; height:950px;">
</embed>
http://salesforce.stackexchange.com/questions/18243/how-to-preview-documents-in-salesforce
Regards,
Ashish