Solved

Excel XML

Posted on 2011-09-13
9
311 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 57

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
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 
LVL 57

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 57

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

752 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