An Easy Way to Embed Excel in a Web Page

> Edraw Tip > An Easy Way to Embed Excel in a Web Page
Posted by James Freeman |
An Easy Way to Embed Excel in a Web Page is to use the Edraw office viewer component directly.

Many people need to display Excel content on web page or allow an Excel report to be viewed embedded on a Web page. And at present the options for doing so are very limited.

The excel component allows the developers to embed Excel anywhere in a web application by simply inserting the html object and using the javascript or vbscript to interact the Excel.

Click Here to Download Office Component - Support Word, Excel, PowerPoint, Visio and Project

free download5 MB

embed excel

Office Viewer Component Online Demo

The following codes describe an approach to displaying Excel documents within a web page using file.

This is how you use the office viewer component to host ms Excel document.

<object classid="clsid:7677E74E-5831-4C9E-A2DD-9B1EF9DF2DB4" id="OA1" width="100%" height="100%" codebase=",5,0,355">
<param name="Toolbars" value="-1">
<param name="BorderColor" value="15647136">
<param name="BorderStyle" value="2">

And this is how you display an excel document on the fly.

function OpenFromServer()
var sPath= window.prompt("Type the file url:", "");
document.all.OA1.Open(sPath, "Excel.Application");

The Excel component has some events to help developers load an excel file when the web page loads or set the component properties.

The following script is to hide the toolbar and grid when the component was initialized.

function EDOffice_NotifyCtrlReady()
document.all.EDOffice.BorderStyle = 1;
document.all.EDOffice.Toolbars = false;
<SCRIPT LANGUAGE=javascript FOR=EDOffice EVENT=NotifyCtrlReady>

The Excel Component allows the developer to do the Excel automation.

function VBAProgramming()
if(document.all.OA1.GetCurrentProgID() == "Excel.Application"){
var objExcel = document.OA1.GetApplication();
var worksheet = objExcel.ActiveSheet;
worksheet.cells(1,1).value ="100";
worksheet.cells(1,2).value ="101";
worksheet.cells(1,3).value ="102";
worksheet.cells(2,1).value ="103";
worksheet.cells(2,2).value ="104";
worksheet.cells(2,3).value ="105";

It's possible to use the above code in ASP, ASP.NET or PHP language, too. The component supports seamless integration with Excel 97, Excel 2000, Excel 2003, Excel 2007 and Excel 2010.

Embed MS Excel in VB 6 and Do the Excel Automation

Embed MS Office in ASP.NET Program

Embedding MS Project

Embedding Visio

Embedded MS PowerPoint

Disables MS Word Standard Command

Disable Office Ribbon Button

Show/Hide Office Menu Bar

download EdrawMind
main page

Get Started! You Will Love This Easy-To-Use Diagram Software

EdrawMax is an advanced all-in-one diagramming tool for creating professional flowcharts, org charts, mind maps, network diagrams, UML diagrams, floor plans, electrical diagrams, science illustrations, and more. Just try it, you will love it!