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
Sanjay Parmar 19Sanjay Parmar 19 

Export Excel in VF Page - Image not getting displayed while using dynamic image URL

I am exporting a VF page as Excel document. While I export excel file, Image cell contains blank data. Below is my VF page code. It is working fine if I am using static url (<img alt="Image" src="https://myorgurl/resource/DefaultProfileImage" />) instead of dynamic Image url.
<apex:page controller="Users_Profile" contentType="application/vnd.ms-excel#Users.xls">
        <table border="0" cellspacing="0" cellpadding="0" style="width:100%;">
            <thead>
                <tr>
                    <th>Profile Image</th>
                    <th>Name</th>
                    <th>City</th>
                    <th>State</th>
                </tr>
            </thead>
            <tbody>
                <apex:repeat value="{!lstUsers}" var="user">
                    <tr>
    					<td>
    						<image alt="Image" src="{!BaseUrl}{!URLFOR($Resource.DefaultProfileImage)}" />
    					</td>
                        <td>{!user.Name}</td>
                        <td>{!user.City__c}</td>
                        <td>{!user.State__c}</td>
                    </tr>
                </apex:repeat>
            </tbody>
        </table>
    </apex:page>
I have tried XML structure instead of HTML tags in VF page to get this resolved but it is not working. I referred following answered questions but did not get solution for this.
  1. Exporting image on Excel Sheet from visualforce page.. (https://developer.salesforce.com/forums?id=906F000000097OtIAI)
  2. Visualforce page : Export Results to Excel or CSV (https://developer.salesforce.com/forums/?id=906F00000009UQnIAM)
Dushyant SonwarDushyant Sonwar
Hi Sanjay,

i see a typo error in this
Change this
<image alt="Image" src="{!BaseUrl}{!URLFOR($Resource.DefaultProfileImage)}" />

to
<img alt="Image" src="{!BaseUrl}{!URLFOR($Resource.DefaultProfileImage)}" />

If it does not work
Also check the url that is being generated by these variable {!BaseUrl}{!URLFOR($Resource.DefaultProfileImage)} in the end?

it may be possibel there may be typo error in the url generation.