Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / March 2008

Tip: Looking for answers? Try searching our database.

Pasting edited HTML into Word via interop

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
snixtor@gmail.com - 03 Mar 2008 05:34 GMT
I've got a custom HTML editor that I'm using Word interop to perform
spell checking.  I'm getting the HTML into Word via clipboard copy /
paste using the method "PasteSpecial".  Ordinarily this has worked
fine, but recently I've had reason to edit the content of the HTML
before pasting it into Word, that is, removing image tags before
sending it for a spell-check, because Word (2007) modifies the image
tags and makes them invalid for my application.  The trouble is, as
soon as I edit out the image tags, PasteSpecial no longer functions
properly, throwing the error "Command Failed".  Similarly, if I just
cobble together a bit of HTML manually (with much less metadata than
normally generated) and send it to Word via PasteSpecial I get the
same error.

What could be causing this?  When I'm stripping the img tags the HTML
I'm sending to Word looks pretty standard, the only difference is the
img tag is pulled out, but somehow that upsets Word.
Snixtor - 03 Mar 2008 06:54 GMT
Ah-ha, I found the answer, Word insists on having a well-formatted
header looking like this:

Version:1.0
StartHTML:000000151
EndHTML:000000376
StartFragment:000000265
EndFragment:000000340
StartSelection:000000265
EndSelection:000000340

Modify the content and those indexes are out and Word throws a
wobbly.  Correct them and all is well.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.