You must Sign In to post a response.
  • Category: ASP.NET

    open document using c#

    I need to open the open office spread sheet document on button click in the browser how can i do this.I tried a lot but i could not find code for implementing this.can any one help me out as i am new to this
  • #768547
    Hi,

    We can simply open the Spreadsheet or any kinds of documents using C# coding.
    Suppose you have spreadsheet in your local or server, then you can implement the following code in the button click event.


    System.Diagnostics.Process objDocProcess = new System.Diagnostics.Process();
    objDocProcess.EnableRaisingEvents = false;
    objDocProcess.StartInfo.FileName = Server.MapPath("Your Excel File Path");
    objDocProcess.Start();



    While coding anything related to documents or Spreadsheets kind we need to take care about one thing.
    That is Object clearing. Usually this documents or stuff wont come under the .NET Framework runtime CLR.
    So Garbage collector wont take care of those process. So we need to manually deallocate those memories.

    Thanks,
    Mani

  • #768548
    #$%!@%^&*

  • #768549
    Thank you for your response but i need to open the openoffice spread sheet word document on button click in the browser not microsoft word document can you please help me out

  • #768554
    Hi Manigandan can you please delete the post

  • #768569
    basically to open a open office spread sheet on client machine, you need to have a OpenOffice installed on that machine
    Process.Start method will not help you as it run on server and you want to open it from client machine
    so JavaScript will help you more. Use wIndow.open method to open it

    window.open("file:///xxx.xxx.xx.xx(Shared IP Address)/Images/yyyy.pdf");

    another way is to use File API
    https://w3c.github.io/FileAPI/

    Thanks
    Koolprasd2003
    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]


Sign In to post your comments