You need to sign in to do that
Don't have an account?
Amit Singh1989
Display Excel data in visualforce page
Hi Friends,
here is my problem
"I want to display Excel data in visualforce page".
could any one please explain me that how to do this?
Thanks,
Amit Singh
Hi,
have you upload the excel sheet in documents?if yes then you can show the excel data at visual force page.
to follow this sample code.
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
thank you,
but me requirement is something different....
i want an vf page where user will select any csv file then i want to give a button which will be used to convert that csv file into pdf report...
here is the code which i am using now.
debug is showing result properly for namfile....
but i want to show the result in another vf page in pdf format (by using render as attribute).
I don't know that how to do this.
could you please any modification to do that?
Thank you
one thing you can do create a visual force with renderAs ="pdf " and controller will be same.May be it can help you
Hi Navatar_DbSup,
I am trying as you have suggested in the last post.
But the new page does not display anything.
Thanks,
Amit S
yes, you are right. one thing you can do with excel, you can save that excel in documents and retrive that excel in another page which is renderAs pdf from document object.Tryout this way maybe it help you.
Could you please give me any full example.
Thanks
I used your method but i am unable to show data in vf page.
vf page:-
<apex:page controller="excelpdfwork2" >
<apex:form >
<apex:commandButton action="{!fff}" value="showexcel"/>
</apex:form>
</apex:page>
controller:-
public with sharing class excelpdfwork2 {
/*public excelpdfwork2(){
fff();
}*/
public Pagereference fff(){
document d = [select id,name,type,ContentType from document where name='excel data'];
System.debug('@@@@@'+d);
System.debug('@@contenttype@@@'+d.ContentType);
System.debug('@@type@@@'+d.Type);
System.debug('*****outside if condition***');
PageReference pg;
//if(d.ContentType == 'application/vnd.ms-excel')
//{
System.debug('*****inside if condition***');
id Contentdataid = d.id;
Id strOrgId = UserInfo.getOrganizationId();
String content = '/servlet/servlet.ImageServer?id=' + Contentdataid + '&oid='+ strOrgId ;
System.debug('----url---->'+content);
pg = new PageReference(content);
pg.setRedirect(true);
//return pg;
//}
return pg;
}
}
vf page:
<apex:page controller="test_renderExcelFile" action="{!fff}">
</apex:page>
controller:
public class test_renderExcelFile{
public Pagereference fff(){
document d = [select id,name, ContentType, Type from document where name='Field Description'];
PageReference pg;
id Contentdataid = d.id;
id strOrgId = UserInfo.getOrganizationId();
string content = '/servlet/servlet.ImageServer?id=' + Contentdataid + '&oid='+ strOrgId ;
pg = new PageReference(content);
pg.setRedirect(true);
return pg;
}
}
i got xcel data attchment to get the query, How to display the xcel data to visualforce page?
==============================
Controller
==============================
Public Class UploadReportValue {
String recId;
public UploadReportValue(ApexPages.StandardController controller) {
// recId = controller.getId();
}
public String getFileId() {
String fileId = '';
List<Attachment> attachedFiles = [select Id,body,ContentType from Attachment where parentId =:'a0Zf000000567BR'];
if( attachedFiles != null && attachedFiles.size() > 0 ) {
fileId = attachedFiles[0].Id;
}
return fileId;
}
}
Thankyou...