How to extract .bookmark("Body").range.text WITH the formatting

D

David

Hello.

I need to take the body of incoming Word docs and store it in a database
field, but I need to keep formatting, like bold, tables, etc. How can I
extract the contents of the doc and keep the formatting, so that I can
recreate the doc later, when needed?

Thank you
Dave
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?RGF2aWQ=?=,
I need to take the body of incoming Word docs and store it in a database
field, but I need to keep formatting, like bold, tables, etc. How can I
extract the contents of the doc and keep the formatting, so that I can
recreate the doc later, when needed?
Well, the .Text property doesn't pick up any formatting. The .FormattedText
property will, but you can only use that when passing content between Word
documents. Copying to the Clipboard will pick up the formatting, and you
can retrieve the content as HTML or RTF (although I can't tell you how to
do that).

You could SaveAs to HTML format then upload the entire HTML file into your
database. For Word 2002 and earlier, that's the only way you're going to
get the entire document, including page layout, etc.

If we're talking Word 2003, your best bet would be to use the Range's XML
property. But that's not available for earlier versions.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top