Read WORD DOCUMENTS in ASP.net
Reading WORD DOCUMENTS in ASP.net
Here simple code for Reading Word Documents in ASP.NET 2.0. Here convert Doc file to Html File.
Imports class:
Imports Word
Imports System.Reflection
Code:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
DocToHtml("C:\WordApplication\document\Test.doc", "C:\WordApplication\document\a.html")
End Sub
Private Sub DocToHtml(ByVal docPath As String, ByVal htmlPath As String)
Dim app As New Application()
app.Visible = False
Dim o As Object = Missing.Value
Dim docFile As Object = docPath
Dim doc As _Document = app.Documents.Open(docFile, o, o, o, o, o, _
o, o, o, o, o, o, _
o, o, o, o)
Dim fileName As Object = htmlPath
Dim format As Object = 8
'Html
doc.SaveAs(fileName, format, o, o, o, o, _
o, o, o, o, o, o, _
o, o, o, o)
Dim t As Object = True
app.Quit(t, o, o)
End Sub
Which version of word DLL we will take reference.