Displaying Word doc in ASP.Net using C#

Results 1 to 2 of 2

Thread: Displaying Word doc in ASP.Net using C#

  1. #1
    Join Date
    Dec 1969

    Default Displaying Word doc in ASP.Net using C#

    Whould anybody know how to display a word doc in ASP.Net using C#?<BR>We are doing a project for Uni and we are really short on time.<BR>Please, any help...

  2. #2
    Join Date
    Dec 1969

    Default RE: Displaying Word doc in ASP.Net using C#

    Hi,<BR> Go through this code.This might help u.<BR><BR><BR><BR>public class CComDotNet<BR> {<BR> public static int Main(string[] args)<BR> {<BR> //Variable <BR> Type excel;<BR> object[] parameter= new object[1];<BR> object excelObject;<BR> try<BR> {<BR> //Get the excel object<BR> excel = Type.GetTypeFromProgID("Excel.Application");<BR> //Create instance of excel<BR> excelObject = Activator.CreateInstance(excel);<BR> //Set the parameter whic u want to set<BR> parameter[0] = true;<BR> //Set the Visible property<BR> excel.InvokeMember("Visible", BindingFlags.SetProperty, null, excelObject, parameter);<BR> }<BR> catch(Exception e)<BR> {<BR> Console.WriteLine("Error Stack {0} ", e.Message) ;<BR> }<BR> finally<BR> {<BR> //When this object is destroyed the Excel application will be closed<BR> //So Sleep for sometime and see the excel application<BR> Thread.Sleep(5000);<BR> //Relaese the object<BR> //GC.RunFinalizers() <BR> }<BR> return 0;<BR> }<BR> }<BR><BR>All the best<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts