Excel XML

Hi all,

I am trying to insert an a logo image on my worksheet which i am creating using XML but it is not working.

img="./images/logo.gif";

"   <Row ss:StyleID=\"Default\">" +
"    <Cell ss:MergeAcross=\"9\">"+"<Data ss:Type=\"String\">" +img + "</Data></Cell>" +
"   </Row>";

Your help is much appreciated.
varvoura
varvouraAsked:
Who is Participating?
 
Arno KosterConnect With a Mentor Commented:
Varvoura,

when you save the worksheet as XML file it will not be present because of the limitation of the save to XML format.
for more information, open this microsoft hyperlink.

When you save the worksheet as an .XLSX file however, you can rename this file to .ZIP extension and look up the xml files that it is based on. Those will contain the image.
0
 
Julian HansenCommented:
Have you tried creating a worksheet in excel with the image as you want it then saving as XML to see how Excel saves it?
0
 
varvouraAuthor Commented:
Hi JulianH,

Yes I have but when you try to save the excel worksheet, it discards the image.

I need to be able to do this in code as described above.

Thanks
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
Arno KosterCommented:
You could take a new worksheet, manually insert an image, and save it as an XLSX document.
Then navigate to the document and change the name by adding the .zip extension to the file.
Extract this zip file to a new folder, and locate drawing1.xml in the folder /xl/drawings

In the worksheet that contains the image, you will notice XML entry
<drawing r:id="rId1"/>

in this case the image is inserted as an object, possibly spanning multiple rows & columns. It's precise location is defined in the drawing1.xml file.
0
 
Julian HansenCommented:
Are you using 2003 or higher? There is a restriction with 2003 being able to do this but as far as I know it can be done with 2007/2010 docs
0
 
varvouraAuthor Commented:
julianH,

I need the image to work in all versions of excel

akoster,

I inserted an image, saved it as xml , then when I opened it in wordpad, I couldn't find the
<drawing r:id="rId1"/> line you referring to.


any  other suggestions would be appreciated.
thanks
0
 
Julian HansenCommented:
That was the point of my previous post 2003 does not appear to support images in XML.
0
 
Ingeborg Hawighorst (Microsoft MVP / EE MVE)Microsoft MVP ExcelCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.