It can work but when i use fileupload and when it convert it It shows error.
This file could not be found. (C:\Windows\system32\Input.docx)
I can change the coding and my codeing is
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
' Convert Input.docx into Output.doc
Convert(FileUpload1.FileName, "~/uploads/output.doc", WdSaveFormat.wdFormatDocument)
'
' * Convert Input.docx into Output.pdf
' * Please note: You must have the Microsoft Office 2007 Add-in: Microsoft Save as PDF or XPS installed
' * http://www.microsoft.com/downloads/details.aspx?FamilyId=4D951911-3E7E-4AE6-B059-A2E79ED87041&displaylang=en
'
Convert(FileUpload1.FileName, "~/uploads/output.pdf", WdSaveFormat.wdFormatPDF)
' Convert Input.docx into Output.html
Convert(FileUpload1.FileName, "~/uploads/output.html", WdSaveFormat.wdFormatHTML)
End Sub
' Convert a Word 2008 .docx to Word 2003 .doc
Public Shared Sub Convert(ByVal input As String, ByVal output As String, ByVal format As WdSaveFormat)
' Create an instance of Word.exe
Dim oWord As word._Application = New word.Application()
' Make this instance of word invisible (Can still see it in the taskmgr).
oWord.Visible = False
' Interop requires objects.
Dim oMissing As Object = System.Reflection.Missing.Value
Dim isVisible As Object = True
Dim [readOnly] As Object = False
Dim oInput As Object = input
Dim oOutput As Object = output
Dim oFormat As Object = format
' Load a document into our instance of word.exe
Dim oDoc As word._Document = oWord.Documents.Open(oInput, oMissing, [readOnly], oMissing, oMissing, oMissing, _
oMissing, oMissing, oMissing, oMissing, oMissing, isVisible, _
oMissing, oMissing, oMissing, oMissing)
' Make this document the active document.
oDoc.Activate()
' Save this document in Word 2003 format.
oDoc.SaveAs(oOutput, oFormat, oMissing, oMissing, oMissing, oMissing, _
oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, _
oMissing, oMissing, oMissing, oMissing)
' Always close Word.exe.
oWord.Quit(oMissing, oMissing, oMissing)
End Sub