all groups > dotnet interop > august 2006 >
You're in the

dotnet interop

group:

Image problem in converting HTML to MS Word doc


Image problem in converting HTML to MS Word doc s.danyal.k NO[at]SPAM gmail.com
8/24/2006 5:52:31 AM
dotnet interop:
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 <img> tag. 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
RE: Image problem in converting HTML to MS Word doc Peter Bromberg [C# MVP]
8/24/2006 6:14:02 AM
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




[quoted text, click to view]
Re: Image problem in converting HTML to MS Word doc Peter Jamieson
8/24/2006 2:36:41 PM
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

[quoted text, click to view]

AddThis Social Bookmark Button