Click here to Skip to main content
15,887,854 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi all.

I am looking for a way to read the text inside a word document text box. The best i have is a red underlined code:

C#
doc.Shape(


This is embarrassing but it is all i got after days of research. Please assist me as i am now totally stuck.
Posted

1 solution

C#
//after activating the document

foreach(Microsoft.Office.Interop.Word.Range newRange in doc.StoryRanges)
{
    //Pick the object you want to process
    nrwRange.Select();
    //Select the text in the Text Box in Word document.
    string textInTextBoxFromMSWordDocument = newRange.Text;
    //pardon the weird variable name. Just trying to be brief and descriptive as possible.
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900