+ Start a Discussion
GennadiyGennadiy 

VisualForce to Excel: images not displayed

Hi, Guys.

I'm trying to create a VF-page which is opened as Excel file. I didn't meet any problems with text, tables, CSS-styles, but I can't insert images into the document. Images are not displayed (I can see their borders only) in Excel editor.
Let me provide simple test code of my VisualForce page:

<apex:page controller="TEST_ExcelReportController" standardStylesheets="false" sidebar="false"
  showHeader="false" showChat="false" contentType="application/vnd.ms-excel#Test_ExcelReport.xls">
    <table>
        <tr>
            <td>
                <apex:image url="http://icons.iconarchive.com/icons/benjigarner/softdimension/256/Excel-icon.png"/>
            </td>
            <td>
                <img src="http://images.google.com/intl/en_ALL/images/logos/images_logo_lg.gif"/>
            </td>
        </tr>
    </table>
</apex:page>


Does anybody know how we can correctly insert images in Excel-files?
srilakshmi1.387861669756762E12srilakshmi1.387861669756762E12
this code is working properly i tested ,images are displayesd in excel.
srilakshmi1.387861669756762E12srilakshmi1.387861669756762E12
    like this it is commingUser-added image
GennadiyGennadiy
hmm, that's really strange. It didn't work for me, but today I've re-setup my Excel and now the code works.

Thank you, srilakshmi1.
GennadiyGennadiy
Hello, colleagues.

One more point about this simple page. Images are not displayed in Microsoft Excel 2011 for Mac.

Does anybody know how we can display images for Excel 2011 for Mac?
Rudi HulsbosRudi Hulsbos
Hi All,

We are having this issue with Excel 2013. Images are not displaying. Any idea how to resolve this issue?

Thanks,
Rudi
GennadiyGennadiy
Hi, Rudi Hulsbos.

I didn't find a way how to make it working in MS Excel for Mac although it worked good in MS Excel 2010 for Windows. After many efforts I made the following conclusions:
- Salesforce does not provide normal way to generate Excel documents;
- All that we are trying to do is to generate html/xml content which can be recognized by MS Excel. But, of course, MS Excel expects to get binary files. Support of all other files is optional and depends more on a local environment/configuration than on a format of your html/xml content. So, you can never guarantee that your image will be displayed correctly in different versions of MS Excel in different environments (Windows/Linux/Mac)
- Because of 2 facts above, it's better to exclude images from the template.


Of course, if, after all, you find any real working approach for this issue, it would be great if you share some details with us.