Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: .NET DLL
Hi,
 
Web application Microsoft.Office.Interop.Word not working on the server.But it works fine in local machine. The application hosted in arvixe. I want to show a document(which is word, PDFs...etc) in a text box. The working in local machine is smooth but in live it is empty text box.The application developed in .Net.My VB.Net code for this purpose is given below.
 
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
 
       If Not Session("r_id") Is Nothing Then
 
           iframe.Visible = False
           Text_resume.Visible = False
           Dim resume_name As String = Session("r_id") 'Server.HtmlEncode(Request.QueryString("r_id"))
           Dim filepath As String = resume_name
           Dim fileextention As String = Path.GetExtension(filepath)
           If Not fileextention = ".pdf" Then
               Text_resume.Visible = True
               Dim realpath As String = MapPath("../jobseeker/Resume/" + filepath)
               readFileContent(realpath)
           Else
               Dim realpath As String = "../jobseeker/Resume/" + filepath
               iframe.Visible = True
               iframe.Disabled = True
               iframe.Attributes.Add("src", realpath & "?docId=456#toolbar=0")
           End If
 
       End If
       lbl_check.Text = _path
 
   End Sub
   Private Sub readFileContent(ByVal path As String)
       Try
           Dim wordApp As New ApplicationClass()
           Dim file As Object = path
           _path = path
           Dim nullobj As Object = System.Reflection.Missing.Value
           Dim doc As Microsoft.Office.Interop.Word.Document = wordApp.Documents.Open(file, nullobj, nullobj, nullobj, nullobj, nullobj, _
           nullobj, nullobj, nullobj, nullobj, nullobj, nullobj, _
           nullobj, nullobj, nullobj, nullobj)
           doc.ActiveWindow.Selection.WholeStory()
           doc.ActiveWindow.Selection.Copy()
           Dim sFileText As String = doc.Content.Text
           doc.Close(nullobj, nullobj, nullobj)
           wordApp.Quit(nullobj, nullobj, nullobj)
           Text_resume.Text = sFileText.ToString()
       Catch ex As Exception
           'alert.show_mssg(panel_mssg, lbl_mssg, "mssg_fail", "Your enquiries has been inserted successfully")

       End Try
   End Sub
 
Thanking in Advance.

Muhammed Haris K
Posted 1-Oct-12 20:32pm
Edited 2-Oct-12 1:12am
v5
Comments
NeonMika at 2-Oct-12 3:42am
   
Is any exception thrown?
Is office installed on the machine? We had the problem that we had the .dll, but the dll is not working without an office installed.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You cannot use the Interop libraries without Office installed. This is a requirement from Microsoft, so even if you figured out how to do it you would be violating the EULA. There are alternatives (Aspose, OOXML SDK, etc.) that might be useful but to use Interop on the server, you need to install Office.
 
References:
http://stackoverflow.com/questions/4724765/manipulating-word-documents-on-server-without-office-installed-asp-net[^]
http://social.msdn.microsoft.com/Forums/is/innovateonoffice/thread/973ce94f-5235-4be9-a2b1-51ba7d35e1f3[^]
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

How can i use Aspose,OOXML SDK for this purpose?
 

Thanking in Advance.
 
Muhammed Haris K
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 210
1 kbrandwijk 100
2 Richard MacCutchan 100
3 ProgramFOX 80
4 Mukesh Bhagat 65
0 Sergey Alexandrovich Kryukov 9,050
1 OriginalGriff 8,151
2 CPallini 2,613
3 Richard MacCutchan 2,221
4 Abhinav S 1,928


Advertise | Privacy | Mobile
Web02 | 2.8.140827.1 | Last Updated 4 Oct 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100