Link to home
Start Free TrialLog in
Avatar of varvoura
varvoura

asked on

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
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

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?
Avatar of varvoura
varvoura

ASKER

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
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.
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
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
That was the point of my previous post 2003 does not appear to support images in XML.
ASKER CERTIFIED SOLUTION
Avatar of Arno Koster
Arno Koster
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.