You need to sign in to do that
Don't have an account?
Mr_Khan
Image not getting displayed in Excel
Hi Guys,
I am trying to display my VF page into Excel.Every thing is fine but the Company logo is not getting displayed in the excel sheet. Another thing that i wana ask is .....
Can we do the formatting of the excel sheet from VF itself ??
Thanks in Advance.
Hi,
You can do formatting by using table in your vf page and give the style in table whatever you want.
Try the below code snippet as reference:
<apex:page controller="cls_Excel_Generation_Deal_Contact_Link" contenttype="application/vnd.ms-excel">
<table width="100%" style="" cellpadding="0" cellspacing="0">
<tr>
<td height="100%">
<apex:image url="https://c.ap1.visual.force.com/img/seasonLogos/sales_logo_aloha_sum12.gif" alt="no image"/>
</td>
</tr>
<tr bgcolor="green" > <!-- you will get this color in excel header -->
<th align="left">
Account ID
</th>
<th align="left">
Name
</th>
<th align="left">
Fax
</th>
<th align="left">
Phone
</th>
<th align="left">
Website
</th>
</tr>
<apex:repeat value="{!acc}" var="dcl">
<tr>
<td align="left" bgcolor="yellow">
{!dcl.id}
</td>
<td align="left">
{!dcl.name}
</td>
<td align="left">
{!dcl.fax}
</td>
<td align="left">
{!dcl.phone}
</td>
<td align="left">
{!dcl.website}
</td>
</tr>
</apex:repeat>
</table>
</apex:page>
------------- apex controller-------------
public class cls_Excel_Generation_Deal_Contact_Link
{
public List<Account> acc{get;set;}
public cls_Excel_Generation_Deal_Contact_Link()
{
acc=[select id ,name,website,phone,fax from account];
}
}
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
<apex:page contenttype="application/vnd.ms-excel#sri.xls">
<table>
<tr>
<td>
<apex:image url="http://images.google.com/intl/en_ALL/images/logos/images_logo_lg.gif"/>
</td>
</tr>
</table>
</apex:page>
Are you sure that a direct link to image works? I tried to use <apex:image> tag, but Excel doesn't display correct image (it shows only borders of the picture).
I tried this, but it doesn't work too.
You can see my test code (if it's interesting for you) here (https://developer.salesforce.com/forums?id=906F00000009y8cIAA).