Embedded Word Document into HTML
Many people need to display Microsoft Word content in Html page, and at present the options for doing so are very limited. The Internet Explore can show the MS word in the whole page, but there are lots of bugs for multiple MS instances in the users' computer, and certainly no support for embedding Word. This office viewer component allows the developers to embed Word anywhere in a html application by simply inserting the html object.
The Word Component also supports to embed MS Word in c# .net form vb.net form, WPF program, Delphi window, C++ dialog.
Click Here to Download Office Viewer Component - Support Word, Excel, PowerPoint, Visio and Project
Office Viewer Component Online Demo
This is how you use the office viewer component to host MS word document.
<object classid="clsid:7677E74E-5831-4C9E-A2DD-9B1EF9DF2DB4"
id="OA1" width="100%" height="100%" codebase="https://www.edrawsoft.com/download/officeviewer.cab#7,5,0,355">
<param name="Toolbars" value="-1">
<param name="BorderColor" value="15647136">
<param name="BorderStyle" value="2">
</object>
And this is how you display a Word document on the fly.
function OpenFromServer()
{
var sPath= window.prompt("Type the file url:", "http://www.ocxt.com/demo/samples/sample.doc");
document.all.OA1.Open(sPath, "Word.Application");
}
The Word Component allows the developer to do the office automation.
function VBAProgramming()
{
if(document.OA1.IsOpened)
{
if(document.all.OA1.GetCurrentProgID() == "Word.Application"){
var objWord = document.OA1.ActiveDocument;
var range = objWord.Range(0,0);
var WTable = objWord.Tables.Add(range, 3,3);
WTable.Cell(1,1).Range.Font.Name = "Times New Roman";
WTable.Cell(1,1).Range.Text = "Automation 1";
WTable.Cell(1,2).Range.Font.Size = 18;
WTable.Cell(1,2).Range.Bold = true;
WTable.Cell(1,2).Range.Font.Italic = true;
WTable.Cell(1,2).Range.Text = "Automation 2";
WTable.Cell(2,1).Range.ParagraphFormat.Alignment = 1; // 0= Left, 1=Center,
2=Right
WTable.Cell(2,1).Range.Font.Name = "Arial";
WTable.Cell(2,1).Range.Font.Size = 12;
WTable.Cell(2,1).Range.Bold = false;
WTable.Cell(2,1).Range.ParagraphFormat.Alignment = 2;
WTable.Cell(3,3).Range.Font.Name = "Times New Roman";
WTable.Cell(3,3).Range.Font.Size = 14;
WTable.Cell(3,3).Range.Bold = true;
WTable.Cell(3,3).Range.Font.Underline = true;
WTable.Cell(3,3).Range.ParagraphFormat.Alignment = 0;
WTable.Cell(3,2).Range.Text = "Automation 3";
}
}
}
It's possible to use the above code in ASP, ASP.NET or PHP language, too. The component supports seamless integration with Word 97, Word 2000, Word 2003, Word 2007 and Word 2010.
Embed MS Office in ASP.NET Program
An Easy Way to Embed Excel in a Web Page