Reading a word document into a string c#

MS WORD

    Next

  • 1. =?Utf-8?Q?s=C5=82ownik_francuski?=
    Chc sprawdzi pisowni w tekcie w jzyku francuskim. Jednak dostpne w pakiecie Microsoft Office 2007 (wersja domowa) sowniki to polski, niemiecki i angielski. Jak zainstalowa jzyk francuski?
  • 2. numbering answera can't go from 1 to 2
  • 3. Word 2004 MAC to Word 2000 Winows
    My remote outsourced secretary is preparing docs in Word2000 and emailing to me. I am editing in 20004 MAC and emailing back to her. She tells me she is not seeing the edited doc. but a 'mix' of both! As she is 100 miles away I really cannot see what she means. From this probably incomplete explanation can anyone help. The problem is really grinding my productivity down as I am a busyself employed lawyer.
  • 4. Template Problem?
    I am working with W XP and Word 2003. Whenever I start a new document in Word I get a blank page that has a footer that contains the file name, full path, and the date of printing. I think that at one time I set up a template with this information in the footer. This has been working fine as anytime I am asked about a paper document I know where it is stored and when it was printed. Now I am trying to print a full page of Avery 8160 labels. When I do this the last row of labels print on a second sheet. I am guessing this is because the footer information is causing the page break. I have tried deleting the fields from the footer but this does not help. I would appreciate any help available. Thanks.
  • 5. Question about rotating pictures;clipart.
    I searched MS Word Help for "rotation" and it said: Only drawing objects can be flipped or rotated. If you can convert an object to a drawing object by ungrouping it and then grouping it again, you can flip or rotate it. You won't be able to convert a bitmap to a drawing object. To convert an object, select it, click Ungroup on the Draw menu, and then click Group. If you can't convert the object, open it in another drawing program, rotate it there, and then save it. When you reopen it in Word, it appears rotated. I did one clipart object successfully, but after that MS Word wouldn't allow me to "UNGROUP"....it remained grayed out when I selected the object. Please help. Thanks in advance.

Reading a word document into a string c#

Postby Tim McOwan » Fri, 06 Jan 2006 18:15:59 GMT

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,



Re: Reading a word document into a string c#

Postby Cindy M -WordMVP- » Sat, 07 Jan 2006 23:08:23 GMT

Hi Tim, 

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://www.**--****.com/ (last update Jun 8 2004)
 http://www.**--****.com/ 

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


Similar Threads:

1.Reading a word document into a string

Hi All,

I need to be able to read a word document into a string, can someone post 
some sample code or point me in the right direction please. I've googled on 
this for ages and can't turn up anything useful.

Many thanks, 


2.Reading Text from Word Document into LotusScript String?

Hi,

Can anyone give me some LotusScript code examples
to help me out with this problem?

- I need to be able to open a MS Word document for reading.
- I would like to be able to read in a line of text from
  the Word document into a LotusScript string. I only need
  the text and not concerned about formatting such as bold,
  italics, etc.
- I was hoping to go through each line till the end of the
  Word document.

Help is greatly appreciated. Thanks in advance.

3.How to read word from a string

Greetings,

         I need to read words from a scalar variable and be able to
continue to the next word

Mike

4.!! Reading character by character from a string and check it

hi folks,

i have a table, with 11 rows in  a word doc.
i need to read Names and Dates from a Sentence. 
Names are all in UPPERCASE as STEVE.
Dates are in different formats.
i need a routine to read character by character and check if Uppercase, using UCase or if Lowercase using LCase or any other character.
Using the same routine i need to recognise a date from the sentence.
These are then displayed in text boxes in visual basic.
In this table there is the following characters: text, integers, spaces " " and foward slashes /. 

any comment appreciated. i need to start from somewhere!

Regards,
Steve

5.read string from table

I'm trying to find a specific table in a Word 2002 document by reading the
string in its first cell and comparing it to a fixed string.  The code looks
like this:

Dim myTest as string
Dim myTable as Table

For tableNo = 1 To totalTables
    Set myTable = ActiveDocument.Tables(tableNo)
    myTest = myTable.Cell(1, 1).Range.Text
    If myTest = "SomeUniqueWord" Then
      blah, blah

The problem is that myTest contains the text from the table plus a couple of
strange characters at the end that show up as rectangles on my screen.
Nothing I have tried seems to get rid of those funny characters or allow me
to make a match on it.  I've tried trim(), as well as other string cleaner
functions and I've tried StrComp() too.  Either it won't match or I get a
type mismatch.

Is there some way to get just the visible characters from the cell?
Thanks, Mark


6. string operation, How to get each word from a string

7. function converting a string to string with first letter of each word - capital

8. Make Word displays strings of text, not strings of code



Return to MS WORD

 

Who is online

Users browsing this forum: No registered users and 43 guest