A1VBCode Forums

How do I Read Word Document Line by Line


http://a1vbcode.com/vbforums/Topic20824.aspx

By shakeelbhatti - 12/4/2006

Hi



I want to read MS Word Document Line by Line Including Images. I am using VB.NET 2003 and 2005 but When I use

Dim AppWord As New Word.Application

Dim WordDoc As Word.Document



WordDoc = AppWord.Documents.Open(FileName)

txtFileContents.Text = WordDoc.Content.Text



the RichTextBox is assigned the plain Text Only and replace with some special Characters where there are Table and Images in the Document.




By Thomas - 5/9/2012

 For i = 1 To oWord.ActiveDocument.Paragraphs.Count          '提取出了Word每段字符的内容
            oWord.ActiveDocument.Paragraphs(i).Range.Select()        '选择此段
            cc = oWord.ActiveDocument.Paragraphs(i).Range.Text       '被选择部分的文本内容
            Debug.Print(cc)
  Next

This way read Word Document paragraph by paragraph.

Hope can help you!