The SAS Output Delivery System and reporting techniques

Adding Images to XML Spreadsheets

Super Contributor
Posts: 358

Adding Images to XML Spreadsheets

Hi All:

I'm relatively new to XML and I have a request to add an image to a spreadsheet that I create using the ExcelXP tagset. It will just be a small banner image in the top corner of the page.

I have tried to find some XML code examples on how this is done, but I can't seem to find any. I would like to place an external link in the spreadsheet that points to an image (.jpg, .bmp) that is in an external library, rather than having the image imbedded in the spreadsheet.

Chevell (SAS) has informed me that the tagset can't do this at this time, but there must be some trick, such as coding the tags in a TITLE statement that would work.

Any help/examples would be appreciated.
Posts: 9,367

Re: Adding Images to XML Spreadsheets

Chevell is right. You can prove it by trying this experiment:
1) open Excel
2) type something in a few cells
3) go to View --> Header and Footers
4) Insert a picture into the Header of the file
5) Save the spreadsheet to XML format

You will see the following message (from Excel):[pre]
The following features from your workbook will not be saved in the XML Spreadsheet
--Page header or footer image
Do you want to continue saving as an XML Spreadsheet?
Coding the images in a TITLE statement works for HTML, RTF and PDF because those destinations support the insertion of images in one form or the other. Microsoft does NOT -- at least for XML at this time. So IF you create an ExcelXP file with ODS, I think your only choice to get an image into the header of the document is to have an Excel Macro or VB script open the xml file, insert the image and then resave as an XLS file.

(Or wait until Microsoft changes the XML spec to accept images.)
Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation