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
|
| Author: Anjum Rizwi 08 Apr 2008 | Member Level: Silver Points : 0 |
Which version of word DLL we will take reference.
|