473,842 Members | 1,847 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Embed an image in an .xls Excel sheet

code green
1,726 Recognized Expert Top Contributor
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 19557
Atli
5,058 Recognized Expert Expert
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 Recognized Expert Top Contributor
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 Recognized Expert Expert
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 Recognized Expert Top Contributor
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 Recognized Expert Expert
@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 Recognized Expert Top Contributor
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 Recognized Expert Expert
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
35572
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 and extract information from specific worksheets and cells. I'm not really sure how to get started with this process. I ran the COM Makepy utility from my PythonWin (IDE from ActiveSTate),
4
82472
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 there is no way I can save the Excel sheet after it has been change. The Excel menu is not active and the system is not asking whether I want to save the changes or not.
0
1350
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
31579
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 necessarily need all the toolbars because I will write code to manipulate the sheet from the back end. I've imported the Excel Object model reference but I'm at a loss of how to display a worksheet object inside the form.
3
9932
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 (SP1) installed. The error is: System.Runtime.InteropServices.COMException(0x800A03EC): Exception from HRESULT: 0x800A03EC. at Microsoft.Office.Interop.Excel._Worksheet.Paste(Object Destination, Object Link) at...
0
1734
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 of that I want to create Image Button and give the Microsoft excel image to it. Where could I get the Microsoft excel image? Can I use that image on my webpage or does it have any restrictions? Thanks,
1
3448
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 partially work. The problem is that when I embed the XLS files PowerPoint is not running and has no way of capturing the XLS image and embedding it into the PPT. When the user opens the PPT they are presented with hundreds of “Object...
3
13611
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 find some place where I could look up a HOWTO doc/recipe to do that using either pyExcelerator or win32com.client. Could someone point me in the right direction? I'm at the stage where the spreadsheet and associated data worksheets
2
6427
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 method.... it creates 6 sheets # region Namespaces using System;
0
9865
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9709
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10936
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10609
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10669
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10303
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7025
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5882
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3140
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.