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
DivyaReddyDivyaReddy 

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>
       </apex:pageBlockTable>
  </apex:pageBlock>
</apex:page>

SrikanthKuruvaSrikanthKuruva

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??

 

sekharasekhara

Image is not displaying in to excel sheet

SrikanthKuruvaSrikanthKuruva

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

DivyaReddyDivyaReddy

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 .

 

 

 

alaschgarialaschgari

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).

alaschgarialaschgari

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

SFDC_2706SFDC_2706
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}">
    {!xmlheader}
    <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">
         
        <OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">
            <AllowPNG/>
        </OfficeDocumentSettings>
        
        <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
            <WindowHeight>7845</WindowHeight>
            <WindowWidth>12045</WindowWidth>
            <WindowTopX>630</WindowTopX>
            <WindowTopY>630</WindowTopY>
            <ProtectStructure>False</ProtectStructure>
            <ProtectWindows>False</ProtectWindows>
        </ExcelWorkbook>

<Worksheet ss:Name="Cover">
  <Table>
  <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"/>

    <Row>
        <Cell  ss:Index="2" ss:StyleID="s9_confidential" ss:MergeAcross="3"><Data ss:Type="String">CONFIDENTIAL</Data></Cell>
    </Row>
    <Row></Row>
      
<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>
    </Row>
    <Row>
        <Cell  ss:Index="2" ss:StyleID="s_cover_heading_lab" ss:MergeAcross="3"><Data ss:Type="String">Test Data</Data></Cell>
    </Row>
    <Row></Row>    
</Worksheet> 
   </Workbook>  
</apex:page>
    
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.

Thanks
Jags
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">
{!xmlheader}
<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">
    <WindowHeight>8535</WindowHeight>
    <WindowWidth>12345</WindowWidth>
    <WindowTopX>480</WindowTopX>
    <WindowTopY>90</WindowTopY>
    <ProtectStructure>False</ProtectStructure>
    <ProtectWindows>False</ProtectWindows>
</ExcelWorkbook>

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

<Styles>
    <Style ss:ID="Default" ss:Name="Normal">
        <Alignment ss:Vertical="Bottom"/>
        <Borders/>
        <Font ss:bgcolor="#FF0000"/>
        <Interior ss:bgcolor="#FF0000"/>
        <NumberFormat/>
        <Protection/>
    </Style>
    <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>
    <Style ss:ID="s23">
        <Font x:Family="Swiss" ss:Bold="0" ss:bgcolor="#FF0000"/>
    </Style>
    <Style ss:ID="s66">
        <Font ss:FontName="Calibri" x:Family="Swiss" ss:Size="16" ss:Color="#000000" ss:Bold="1" ss:Italic="1"/>
    </Style>
</Styles>
<!--------------First Sheet ------------->
<Worksheet ss:Name="Sheet1">
    <Table ss:ExpandedColumnCount="100">
        <Column ss:Width="180"/>
        <Row>
            <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>
        </Row>
        <Row>
            <Cell ss:StyleID="s16" ><Data ss:Type="String">Field1</Data></Cell>
            <Cell ss:StyleID="s16"><Data ss:Type="String">Field2</Data></Cell>
        </Row>
    <apex:repeat value="{!sample}" var="row">
        <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>
       </Row>
    </apex:repeat>
   </Table>
</Worksheet>

</Workbook>
</apex:page>
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?