aj_adriano

I've tried using Word.Range.Copy function, then get the data from Clipboard in "HTML Format". However the data inside the clipboard is in MSHTML format. I need to convert the data in simple HTML because the application which needed this data does not understand MSHTML. Is there any other way to get the data in a specific range in HTML format (or do you guys know how to convert MSHTML to simple HTML )

Thanks!

AJ



Re: Visual Studio Tools for Office How do you get data/text in Word.Range in HTML format?

Cindy Meister

Hi AJ

No, there's nothing built-into Word or Office that will let you do this via the Clipboard. One possibility would be for you to write code that does a conversion ("transform") on the MSHTML before passing the "cleaned" HTML to your app.

The only other way is to copy the range to a new (empty) document then use File/Save As, saving it as an HTML file. Word's internal HTML converter is capable of saving to different "flavors" of HTML. How well this works, and to what extent you can influence the HTML output, depends on the version of Word involved, which you do not mention, unfortunately.






Re: Visual Studio Tools for Office How do you get data/text in Word.Range in HTML format?

aj_adriano

i also thought of that idea, but it will be very slow if i do that because i'll be repeating this same process a lot of times.

Also, do you know of any GPL library for converting RTF to HTML that accepts a string that represent the RTF as a parameter for the conversion function. Conversion functions of most libraries has a filename parameter. What I need is to convert the RTF directly to HTML from a string.

I can copy the range as RTF, then i just need to convert it to HTML...





Re: Visual Studio Tools for Office How do you get data/text in Word.Range in HTML format?

Cindy Meister

There may well be third-party DLLs available on the market for this purpose. One company I know of that has lots of interesting converters is AltSoft, for example.