Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

Read a Word Document Using C#

Word.Application word = new Word.Application();
       Word.Document doc = new Word.Document();
       object fileName = @"C:wordFile.docx";
        // Define an object to pass to the API for missing parameters
        object missing = System.Type.Missing;                
        doc = word.Documents.Open(ref fileName,
                ref missing, ref missing, ref missing, ref missing,
                ref missing, ref missing, ref missing, ref missing,
                ref missing, ref missing, ref missing, ref missing,
                ref missing, ref missing, ref missing);
        string ReadValue = string.Empty;
            // Activate the document
        doc.Activate();

         foreach (Word.Range tmpRange in doc.StoryRanges)
         {
            ReadValue += tmpRange.Text;
         }
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Read #Word #Document #Using
ADD COMMENT
Topic
Name
7+8 =