Word front end

Word front end

  • Comments 2

After a few hours of struggling with how to convert a Word Range object to HTML, and a few more struggling with weird 401s on ASP .NET, I mostly have this working... I think.

Unfortunately, I couldn't find an easy Range.ConvertToHtml method or anything like that, so for the time being I am doing an enormous hack and copying the range to the clipboard, getting the HTML fragment, then removing a bunch of Word 'baggage' to get something that resembles normal HTML. You'd think it would be easier than this... maybe there is a magic method somewhere, but I couldn't seem to find it (not that I looked too hard... the sign of a true geek is someone who will implement something them selves rather than spend more than 2 minutes looking at IntelliSense and the barest minimum docs ;-) ).

Obviously this is no good because it clobbers whatever is in the clipboard... my next thing to try is to use the Word OM to convert paragraphs, hyperlinks, lists, formatted text, etc. into the appropriate HTML, but that could take a while.

Now all I have to do is figure out how to authenticate with the server... it doesn't appear to be using BASIC authentication, but is instead using forms / cookies. But I haven't really looked into it. There is also (hopefully!) a web service I can call to send the data to the web site, but as a true old-skool JScript hacker I'm going against the HTML forms to begin with.

I'll investigate further this week...

  • I would also like to see ConvertToHtml and ConvertToRtf methods. But what about using Range.XML along with a transform?
  • Yes, that should work. I got the same response from the folks on the Word team. Thanks for caring ;-)
Page 1 of 1 (2 items)