Solved

Excel XML

Posted on 2011-09-13
9
313 Views
Last Modified: 2012-06-21
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
0
Comment
Question by:varvoura
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1
9 Comments
 
LVL 58

Expert Comment

by:Julian Hansen
ID: 36528649
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
 

Author Comment

by:varvoura
ID: 36528661
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
 
LVL 19

Expert Comment

by:Arno Koster
ID: 36528672
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
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
LVL 58

Expert Comment

by:Julian Hansen
ID: 36528689
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
 

Author Comment

by:varvoura
ID: 36528735
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
 
LVL 58

Expert Comment

by:Julian Hansen
ID: 36528749
That was the point of my previous post 2003 does not appear to support images in XML.
0
 
LVL 19

Accepted Solution

by:
Arno Koster earned 500 total points
ID: 36535736
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
 
LVL 50
ID: 37087215
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
Create a Windows 10 custom Image with custom task bar and custom start menu using XML for deployment.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question