How can I control MS Excel within a browser?

Posted on 2006-03-23
Last Modified: 2008-01-09
I need to allow a user to open Excel files within a browser, edit them and then save them remotely back to the server.
I am using the following code to open Excel but it is popping up in a separate window outside the browser. How can I force Excel to open inside the browser ?

var myActiveX = new ActiveXObject("Excel.Application");
Question by:philfcorcoran

    Expert Comment

    Maybe not exactly an answer to your question. But have you thought of using
    This takes away a lot of development and maintenance on your side.


    Author Comment

    Nice site and very good interface but it's not what I need. I am part of a team writing an application for users to edit MS Office documents remotely and save them transparently back to the server.
    LVL 29

    Expert Comment

    Opening the spreadsheet outside the browser...that behavior is dependent on the local settings of the PC with the browser and those are not available to your web server or its scripts to manipulate.  The only browser which might open the spreadsheet without opening a new window is IE and that may or may not work after the April-06 security update for IE which is also going to cripple ActiveX. (MS lost a lawsuit to Eolas on patent infringement re: ActiveX [])

    As to the saving of the results: When the client browser loads an excel spreadsheet it is saved to that local machines temporary internet files (cache) and opened from there. After editing, any attempt to save changes will open a dialog to save the file on the local machine...not the server.  This of course is due to the security model of the browser and web server.  For the client to be able to save the changed file back to the server, the client must have write permissions on the server to the directory where the spreadsheet exists.

    Normally, giving write access to the client browser is not a good idea.  e.g. the client can then write any file in the directory and hack away at their pleasure.  If you will do this, you should isolate the files to a separate directory or even a virtual directory outside of the web root.  Authentication is preferred so you are not giving IUSR_machine write permissions.

    Http is a disconnected protocol so there is no way to maintain file lock information and multiple people could change the same file or crash into each other with an attempt to write the file simultaneously.  WebDAV may assist the with file locking issue and I notice some indication that you may be using WebDAV.

    Some possibly related questions with answers:


    Author Comment

    Thanks for your response. Looks like we will have to live with Excel opening outside of the brwoser since we do not want to get involved in desktop maintenance. We developed a prototype using webdav. A user can map a drive in windows to a webdav url. Then we have a servlet respond to the webdav messages such as lock or move. The user can then open files on the web server using windows explorer, edit them and save his changes.However the client could then be any windows application such as windows explorer, excel, word etc. We want to limit the number of clients we support so we wanted to integrate better with the browser.We tried using java applets also. The  browser security model is definitely a limiting factor. The vbscript shown previously means that a user has to accept ActiveX and our operations team saw this as a security risk.
    LVL 29

    Accepted Solution

    >The  browser security model ...

    Yes. Many, many people run into this frustration. Thin Client, Fat Client and Browser Client all have their place, but trying to make a browser act like a thin clinet is not going to be possible because of security. Circimventing the browser's security will lead to more problems than you solve.

    Java Applets, ActiveX and other technologies offer a change for more client side interaction but also come with a cost. I don;t think many of us have a grasp on what the full impact of the Eolas patent settlement will bring but I think a lot of Intranet applications are going to break in a few weeks.  Funny enough, it was mentioned that some NS/Gecko plugins also violate the Eolas patent but Eolas said they were not going to sue the open source browser companies.

    For really good interaction, I tend to want to look at a server side presentation layer for the excel spreadsheets rather than opening them on the client. That involves a tremendous amount of programming and has its down side as well, but there are products available to do that.

    I gave up on WebDAV many years ago for some of the reasons you are struggling with. That does not mean it does not have value or potential, but it seemed to be more trouble than it was worth.

    Sorry the suggestions were not more substantive.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
    I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
    The viewer will learn how to dynamically set the form action using jQuery.
    The viewer will learn how to count occurrences of each item in an array.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now