Reply
 
Thread Tools Display Modes
  #1   Report Post  
AMercer
 
Posts: n/a
Default Programming Open and SaveAs

I am experienced with VB and .Net, but not so experienced with Word.

In Word, I can open a url, eg "http://moneycentral.msn.com/home.asp" and
then SaveAs plain text, thereby removing all of the html codes. So far so
good.

I've figured out how to automate this functionality via Word Automation, but
with some difficulty and problems. Word seems to get bent with locked files,
and SaveAs requires that I actually save a file which I don't really want to
do. And sometimes I get popups, eg a warning about SaveAs losing cascading
styles, etc. So far, not so good.

What I really want is the file transformation of Word's SaveAs Plain Text
but without any Word baggage at all. I have a Visual Basic .NET string
variable with the text of a url (what you see with IE View Source), and what
I want is a function that returns a string with all the html stripped out (ie
what SaveAs does but without any file IO). The .NET documentation hints at
converters of this sort, but a hint leaves me short.

Any ideas?

  #2   Report Post  
Cindy M -WordMVP-
 
Posts: n/a
Default

Hi ?B?QU1lcmNlcg==?=,

What I really want is the file transformation of Word's SaveAs Plain Text
but without any Word baggage at all. I have a Visual Basic .NET string
variable with the text of a url (what you see with IE View Source), and what
I want is a function that returns a string with all the html stripped out (ie
what SaveAs does but without any file IO). The .NET documentation hints at
converters of this sort, but a hint leaves me short.

Two possibilities come to mind.

1. Just read the document text into a string variable:
sDocContent = doc.Range.Text

2. Copy the text to the Clipboard, then use the PasteSpecial functionality to
paste as plain text

Note: This is an end-user newsgroup, which you ought to have noticed if you
read a few messages before posting. An office.developer or word.vba group would
have been better for your question. You'd have likely gotten a reply long before
this...

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
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 :-)

Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:45 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"