473,395 Members | 1,972 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Embed an image in an .xls Excel sheet

code green
1,726 Expert 1GB
I have written scripts that generate price lists on a .xls sheet.
The price lists are written in HTML so I can embed an image easily using <img src .........

But when the .xls leaves the local folder, ie emailed out,
it can no longer 'see' the image because the src path is no longer valid.

How are images permanently embedded in .xls? or HTML for that matter.
The code behind is HTML so am I missing a trick somewhere?
Jun 4 '09 #1
7 19500
Atli
5,058 Expert 4TB
You can embed images into a <img> tag by doing:
Expand|Select|Wrap|Line Numbers
  1. <img src="data:[mime-type],[data]" alt="" />
For example, to display a 16x16 PNG filled with red (borrowed from the W3C html validation site):
Expand|Select|Wrap|Line Numbers
  1. <img alt="Red square" src="data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%10%00%00%00%10%08%02%00%00%00%90%91h6%00%00%00%19IDAT(%91c%BCd%AB%C2%40%0A%60%22I%F5%A8%86Q%0DCJ%03%00%DE%B5%01S%07%88%8FG%00%00%00%00IEND%AEB%60%82" />
All modern browsers and email clients should be able to understand this.
IE versions 7 and up should be able to handle it to.
Not sure about Outlook tho.
Jun 4 '09 #2
code green
1,726 Expert 1GB
Ah I see.
The example I am looking at uses VML and seems to designate a path
Expand|Select|Wrap|Line Numbers
  1. if gte vml 1]><v:shapetype
  2.    id="_x0000_t75" coordsize="21600,21600" o:spt="75" o:preferrelative="t"
  3.    path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f">
Then the image source quotes only the directory and the file
Expand|Select|Wrap|Line Numbers
  1. <img width=800 height=190
  2.   src="Pricelist-0409_files/image002.jpg" v:shapes="Picture_x0020_5">
I assume what is happening here is the url is embedded and the image is being downloaded from a remote server
Jun 4 '09 #3
Atli
5,058 Expert 4TB
I don't know the first thing about VML, so I can't really say much about that.

Nor about Excel documents, really, but I do know that embedding images, the way I did, is not very popular in emails because Outlook's HTML rendering engine is behind that standards by a couple of decades, and therefore lacks the ability to render them correctly.

So unless this VML markup language has some other way of embedding them, it really only leaves it using remote URLs.
Jun 4 '09 #4
code green
1,726 Expert 1GB
I don't know the first thing about VML
Me neither!
I may use remote URLs until I can figure out this VML.
Jun 4 '09 #5
Atli
5,058 Expert 4TB
@code green
I would check out SVG instead.

I don't know that one either, but it was apparently developed by the W3C after M$ and several others tried to get their version of this standardized.

http://en.wikipedia.org/wiki/Vector_Markup_Language
VML was submitted as a proposed standard to the W3C in 1998 by Microsoft, Macromedia, and others.[1]
Around the same time other competing W3C submissions were received in the area of web vector graphics, such as PGML from Adobe Systems, Sun Microsystems, and others.[2] As a result of these submissions, a new W3C working group was created, which produced SVG.
Jun 4 '09 #6
code green
1,726 Expert 1GB
Thanks Atli, I will check out this SVG.
But it would be no suprise to find that Microsoft has crippled this when used in .xls.
Jun 5 '09 #7
Atli
5,058 Expert 4TB
Yea, your right. That wouldn't exactly come as a great shock :)

There is an alternative to that to, you know. Several, actually.
I like OpenOffice.org.
It can even handle a lot of the M$ Office formats.
Jun 5 '09 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: Allison Bailey | last post by:
Hi Folks, I'm a brand new Python programmer, so please point me in the right direction if this is not the best forum for this question.... I would like to open an existing MS Excel spreadsheet...
4
by: Pawel | last post by:
Hello All I tried to embed Excel sheet into HTML page by following command: <iframe src="Tmp.XLS" width="100%" height="500"></iframe> and it works, showing Excel sheet inside the page, but...
0
by: Aniruddha | last post by:
Dear All, I want to embed a Word or any other type of file in the Excel sheet in C#. I am able to create the Excel file but not able to add the OleObject. -- Aniruddha Gote
2
by: Shawn | last post by:
Does anybody know how to embed an Excel Worksheet into a (vb .net) form? I want the worksheet to appear as though it's a control on the form with all the functionality of a worksheet. I don't...
3
by: | last post by:
I wrote a class in VB.NET to export the contents of a datagrid to Excel. It works perfectly on my machine, but it fails on my customers' PCs that have identical versions of Win XP (SP1) and Excel...
0
by: Sridhar | last post by:
Hi, I have a export to excel function where it exports the data of a datagrid into the excel sheet. For this, I am using the button and the text on that button reads "Export to Excel". Instead...
1
by: snicks | last post by:
I have a series of XLS files which I need to embed into a PowerPoint presentation on an IIS server. I’ll be using VB.NET. I’ve tried using an ASPOSE.PowerPoint control to do this and it does...
3
by: implicate_order | last post by:
Greetings, I'm new to python and am in the process of writing a script to parse some CSV data, spread it across multiple Excel worksheets and then generate charts. I searched the internet to...
2
hemantbasva
by: hemantbasva | last post by:
Note We need to have a template on server for generating report in multiple sheet as we do not had msoffice on server moreover this require a batch job to delete excel file created by the...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.