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


Comments

Author: Anjum Rizwi08 Apr 2008 Member Level: Silver   Points : 0

Which version of word DLL we will take reference.



  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: