By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,564 Members | 810 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,564 IT Pros & Developers. It's quick & easy.

Image problem in converting HTML to MS Word doc

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.