asked on
Public Shared Function Return_Word_Document_Contents(ByVal strUploadPath_and_FileName As String) As String
'Setup word class, file path, and null object to open word document
Dim wordApp As New ApplicationClass()
Dim nullobj As Object = System.Reflection.Missing.Value
'Instantiate the document - requires 9 arguments even if they're null
Dim doc As Document = wordApp.Documents.Open(strUploadPath_and_FileName, nullobj, nullobj, nullobj, nullobj, nullobj, nullobj, nullobj, nullobj, nullobj, nullobj, nullobj, nullobj, nullobj, nullobj, nullobj)
'Make content live & store it in a string
Dim strDocumentContent As String = doc.Content.Text
'Close the document
doc.Close(nullobj, nullobj, nullobj)
'Return the value
Return strDocumentContent
End Function
The .NET Framework is not specific to any one programming language; rather, it includes a library of functions that allows developers to rapidly build applications. Several supported languages include C#, VB.NET, C++ or ASP.NET.
TRUSTED BY