473,385 Members | 1,593 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,385 software developers and data experts.

Image problem in converting HTML to MS Word doc

Hi All,
I have created an application in C# that converts HTML file to MS word
documents. The HTML file may also have images , for e.g "<img
src='http://www.google.com.pk/images/hp0.gif'></img>".
The HTML file saved into .doc file. Now the problem is
that whenever the .doc file is opened it goes to the link mentioned in
the <imgtag. This means that only the link is saved in the .doc file
and not the ACTUAL image. Now I want the actual image to be saved in
the .doc file and not the link to that image. Any idea on this problem
will be appreciated.

Danyal

Aug 24 '06 #1
2 4974
I don't know what you are doing to "convert" your HTML into a word document
file, but in this case your code would need to :

1) Download each image from its url in the HTML document.
2) Convert the image to its Word Doc counterpart using the Word object
model, or
3) Convert the image to its proper MIME -encoding (normally Base64) and
insert the proper MIME boundary headers.

Hope that helps.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"s.********@gmail.com" wrote:
Hi All,
I have created an application in C# that converts HTML file to MS word
documents. The HTML file may also have images , for e.g "<img
src='http://www.google.com.pk/images/hp0.gif'></img>".
The HTML file saved into .doc file. Now the problem is
that whenever the .doc file is opened it goes to the link mentioned in
the <imgtag. This means that only the link is saved in the .doc file
and not the ACTUAL image. Now I want the actual image to be saved in
the .doc file and not the link to that image. Any idea on this problem
will be appreciated.

Danyal

Aug 24 '06 #2
Something along the following lines may be enough - there are other ways to
insert images that are not inline.

Dim strImagePath as String
strImagePath = "http://www.google.com.pk/images/hp0.gif"
rngSomeRange.InlineShapes.AddPicture _
FileName:=strImagePath, _
LinkToFile:=False, _
SaveWithDocument:=True

<s.********@gmail.comwrote in message
news:11**********************@b28g2000cwb.googlegr oups.com...
Hi All,
I have created an application in C# that converts HTML file to MS word
documents. The HTML file may also have images , for e.g "<img
src='http://www.google.com.pk/images/hp0.gif'></img>".
The HTML file saved into .doc file. Now the problem is
that whenever the .doc file is opened it goes to the link mentioned in
the <imgtag. This means that only the link is saved in the .doc file
and not the ACTUAL image. Now I want the actual image to be saved in
the .doc file and not the link to that image. Any idea on this problem
will be appreciated.

Danyal

Aug 24 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: Davinder | last post by:
can anyone recommend a good tool to convert documents to HTML on the fly. I need to integrate this tool with a VB app so it must have an API. thanks in advance Davinder davinder@gujral.co.uk
20
by: Al Moritz | last post by:
Hi all, I was always told that the conversion of Word files to HTML as done by Word itself sucks - you get a lot of unnecessary code that can influence the design on web browsers other than...
8
by: prabha | last post by:
Hello Everybody, I have to conert the word doc to multiple html files,according to the templates in the word doc. I had converted the word to xml.Also through Exsl ,had finished the multiple...
2
by: Asbjørn Ulsberg | last post by:
Hi. I'm trying to convert Brady Hegberg's great RTF2HTML VB 6.0 module to C#. I've managed to convert the VB code to VB.NET, which gave me the following code: Option Strict On Option...
0
by: Mark Allen | last post by:
Hello, I am creating an RTF document server side for a report. However I am having problems converting images into the required RTF format. I am converting the image into a string (binary)...
0
by: Balakrsihna | last post by:
Hi All, Can anyone tell me how to replace an image in MS Word 2003 using c#.net. I am converting an html file to word doc and sending this as attachment using System.Web.Mail; the...
5
by: Steven Hill | last post by:
Hello All! Has C# any classes to convert html page to gif or tif? Anyone could please, give how to do it? Br Wew
6
by: PenguinPig | last post by:
Dear All Experts I would like to know how to convert a HTML into Image using C#. Or allow me contains HTML code (parsed) in Image? I also tried this way but it just display the character "<" &...
2
by: CM | last post by:
Hi, Could anyone please help me? I am completing my Master's Degree and need to reproduce a Webpage in Word. Aspects of the page are lost and some of the text goes. I would really appreciate it....
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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...

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.