+ Start a Discussion

Exporting image on Excel Sheet from visualforce page..

hi to all,


i have a requirement that to covert data from vf page to excel sheet . I am able to export all record & etc... except image field .
Can any one help on this issue..


Here my code :

<apex:page controller="cases_ctrl" contentType="application/msWord" >
<apex:pageBlock title="Cases">
    <apex:pageBlockTable value="{!c}" var="c1">
      <apex:column value="{!c1.CaseNumber}"/>
      <apex:column value="{!c1.Date__c}"/>
     <apex:column><apex:image value="{!c1.Images__c}"/></apex:column>


what is the exact problem you are facing?

I mean when you are exporting to excel the image column is blank or having some value??



Image is not displaying in to excel sheet


so is the blob value of the image getting exported to excel?


I am taking url from documents and directly pasted in to vf page then Image is coming .


But when i am pasting my image url in to a field then i am unable to get image from field .





Hey guys,

any new insights on this topic?

I'd like to export a static resource image to excel. It does not work with a static resource, but with an external URL (http://www.google.de/intl/de_ALL/images/logos/images_logo_lg.gif).


Hardcoded URL to SFDC Static Resource doesn't work either. Image is set to public.

Hi Divya,

Were you able to find the solution for your issue. Actually i am also facing the same problem where i am able to extract all data in excel sheet but couldn't display an image there...!!

Here is my code :

<apex:page controller="XYZ_controller" sidebar="false" showHeader="false"  contentType="application/vnd.ms-excel#{!object.Name__c}_Bid_Preview.xls" cache="true" action="{!changeProposalStatus}">
    <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
        <OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">
        <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">

<Worksheet ss:Name="Cover">
  <Column ss:Width="70" ss:StyleId="s_plain"/>
  <Column ss:Width="100" ss:StyleId="s_plain"/>
  <Column ss:Width="100" ss:StyleId="s_plain"/>
  <Column ss:Width="250" ss:StyleId="s_plain"/>

        <Cell  ss:Index="2" ss:StyleID="s9_confidential" ss:MergeAcross="3"><Data ss:Type="String">CONFIDENTIAL</Data></Cell>
<I NEED TO INSERT AN IMAGE HERE i.e COMPANY'S LOGO> (For testing, any logo will do)

<Row ss:AutoFitHeight="1">
        <Cell  ss:Index="2" ss:StyleID="s_cover_heading" ss:MergeAcross="3"><Data ss:Type="String">Test Data</Data></Cell>
        <Cell  ss:Index="2" ss:StyleID="s_cover_heading_lab" ss:MergeAcross="3"><Data ss:Type="String">Test Data</Data></Cell>
I request your swift support and help on this. Your efforts would be greatly appreciated. Thanks in advance...!!
Muzammil BajariaMuzammil Bajaria
I am not able to insert image in excel sheet. please suggest me some solution.
Jagadeesh GrandhiJagadeesh Grandhi
Hi All,

Any one resolve this issue, I am also facing the same problem, Not able to download the image to excel from visualforce page. If any one got the solution please help me on this.

Kt YadavKt Yadav
I am facing the same issue not able to export image to excel.
Below is my snippet
<apex:page id="pg" standardStylesheets="false" controller="xyzController" contenttype="application/vnd.ms-excel#MultiSheetExcel.xls">
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40">

<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">

<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">

    <Style ss:ID="Default" ss:Name="Normal">
        <Alignment ss:Vertical="Bottom"/>
        <Font ss:bgcolor="#FF0000"/>
        <Interior ss:bgcolor="#FF0000"/>
    <Style ss:ID="s16">
        <Font ss:FontName="Calibri" x:Family="Swiss" ss:Size="11" ss:Color="#FFFFFF" ss:Bold="1" ss:Italic="1"/>
        <Interior ss:Color="#92D050" ss:Pattern="Solid"/>
    <Style ss:ID="s23">
        <Font x:Family="Swiss" ss:Bold="0" ss:bgcolor="#FF0000"/>
    <Style ss:ID="s66">
        <Font ss:FontName="Calibri" x:Family="Swiss" ss:Size="16" ss:Color="#000000" ss:Bold="1" ss:Italic="1"/>
<!--------------First Sheet ------------->
<Worksheet ss:Name="Sheet1">
    <Table ss:ExpandedColumnCount="100">
        <Column ss:Width="180"/>
            <Cell ss:StyleID="s66">
                <Data ss:Type="String">
                    <img src="https://univar--d01sprt01--c.cs14.content.force.com/servlet/servlet.ImageServer?id=xxx&oid=xxx"/>
                <!-- <apex:image value="{!$Resource.SP}" />
                 </Data> -->
            <Cell ss:StyleID="s16" ><Data ss:Type="String">Field1</Data></Cell>
            <Cell ss:StyleID="s16"><Data ss:Type="String">Field2</Data></Cell>
    <apex:repeat value="{!sample}" var="row">
            <Cell ss:StyleID="s23"><Data ss:Type="String">{!row.id}</Data></Cell>
            <Cell ss:StyleID="s23"><Data ss:Type="String">{!row.Name}</Data></Cell>

Tony HerringtonTony Herrington
I also have the same issue.  I am unable to get an image to show up in the generated Excel file. Has anyone found a solution to this yet?