Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.newusers
Tim McOwan
 
Posts: n/a
Default Reading a word document into a string c#

Hi All,

Don't know if this is the right newsgroup but I need the ability to read the
contents of a word document into a string using C# (but any .NET examples
would be great)

Please help.

Thanks,


  #2   Report Post  
Posted to microsoft.public.word.newusers
Cindy M -WordMVP-
 
Posts: n/a
Default Reading a word document into a string c#

Hi Tim,

Don't know if this is the right newsgroup but I need the ability to read the
contents of a word document into a string using C# (but any .NET examples
would be great)

Well, taken absolutely literally, that would go something like this (off the
top of my head, so syntax errors are possible!)

word.document doc = wdapp.ActiveDocument;
string s = doc.Content.Text

this will capture all TEXT in the body of the document - not headers, footers,
footnotes, anything in text boxes, etc. If you need that, then you also need to
loop through the StoryRanges. For more on that, including sample (VBA) code,
look up StoryRange, StoryRanges and all related topics in the object model
Help.

Note that this is most decidedly NOT the best place to ask, as this group is
aimed at end-users :-) One of the office.developer newsgroups would be more
appropriate or, at a pinch a word.vba group.

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
The WordPerfect "Reveal Codes" method is so much easier to use. Torden Microsoft Word Help 8 April 19th 10 07:50 PM
Does Word have a QuickCorrect/Quick Word option like WordPerfect? CW New Users 2 December 20th 05 05:54 PM
Word2000 letterhead merge BAW Mailmerge 3 June 25th 05 01:17 PM
is word perfect compatible with office word? Noreen Microsoft Word Help 1 May 11th 05 11:17 PM
Macros - Keyboard Commands Janet Microsoft Word Help 6 April 11th 05 05:28 AM


All times are GMT +1. The time now is 12:06 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"