Thursday, September 26, 2013

Read word document

Imports System.IO
Imports NPOI.XWPF.UserModel
 
Public Class Form1
    Private Sub btnReadDocument_Click(sender As Object, e As EventArgsHandles btnReadDocument.Click
        Dim wDoc As XWPFDocument = Nothing
        Dim filePath As String = "C:\sample2\sample-file.docx"
 
        Using fs As New FileStream(filePath, FileMode.Open)
            wDoc = New XWPFDocument(fs)
        End Using
 
        For Each prg As XWPFParagraph In wDoc.Paragraphs
            Console.WriteLine(prg.GetParagraphText)
        Next
    End Sub
End Class

No comments:

Post a Comment