Office OCX & Office Component

Embedding MS Word, Excel and PowerPoint with Edraw Office Viewer Component

Edraw Office Viewer ActiveX Control

Pick Products>>
Edraw Max

flowchart, organizational chart, network diagram software

Lightweight yet incredibly powerful diagramming tool with rich examples and stencils. Easy to create professional-looking flowcharts, network diagrams, organizational charts and more. Free Download

What's new in the Edraw Office Viewer Component
Embed Word, Excel, PowerPoint in your form or web page
How To embed and automate Office documents with Visual Basic
ActiveX Control Digital Signatures / Code Signing
Office Automation Support
Host multiple office viewer component in a form
Upload a file to web server in ASP.NET
How to allow download the unsigned ActiveX control
Solution for the click to activate and user the control
ActiveX Control Digital Signatures / Code Signing
Office Automation Support
Host multiple office viewer component in a form
Upload a file to web server in ASP.NET
How to allow download the unsigned ActiveX control
Relative Resource>>

Edraw Office Viewer ActiveX Control acts as an ActiveX document container for hosting Word documents in a custom form or Web page. The OCX is lightweight and flexible, and gives developers new possibilities for using Microsoft Office in a custom solution.

Sales online:

Support Office 97, Office 2000, Office XP, or Office 2003 in Windows OS.

Embedding Word, Excel, PowerPoint with Office Viewer Component

It can be easily integrated into applications written in languages that support ActiveX control such as Visual C++, Visual Basic, Delphi, C++ Builder and .Net languages. Support Office automating client to custom your application. Include abundant sample codes. You can also get the full c++ source codes.


Name: Office Viewer OCX or Office Viewer ActiveX Control

CLSID: 18A295DA-088E-42D1-BE31-5028D7F9B9B5

Version: 7,5,0,356

Release Date: 2011-11-11

OCX Size: 1148KB


How to add Office ActiveX Control to your Visual Basic 6.0 project 

1.       From the Project Menu select Components…

2.       Select control “Office Viewer ActiveX Control”

3.       Click the OK Button

4.       The control will now appear in your toolbox

5.       Drag and drop the control on your form

There are some methods and properties to operator the office control.


Code a solution using the control

The control is very customizable. You can change the color scheme of any of the control elements, as well as determine the border type and a custom caption. These can be set at run time or design time as needed.

1.        Create new documents

Function void CreateNew(BSTR ProgId);

Description: Creates a new document based on the ProgID.

Office Document Type:

Excel Spreadsheet: progID is “Excel.Sheet”;

Excel Chart: ProgID is “Excel.Chart”;

PowerPoint Presentation: ProgID is “PowerPoint.Show”;

Project: ProgID is “MSProject.Project”;

Visio Drawing: ProgID is “Visio.Drawing”;

Word Document: ProgID is “Word.Document”..

The component allows you to create new documents for any ActiveX document type that is registered on the system. A user can use the custom function that you provide to create new documents.


2.        Open Local documents

Function: boolean Open(BSTR Path);

Description: Opens a document from a local file.

You can also open and edit Office documents that exist on a local drive. You can call the Open method directly and give the control a specific file to open.


3.        Open Web folder

Function: boolean OpenWebFile(BSTR FileUrl);

Description: Opens a document from a web folder.

You can also open and edit Office documents that exist on web folder. Open takes either a qualified file path or a URL to a file on a remote Web server. For example, the following code opens a web file.

OA1. OpenWebFile ""


4.        Show Open File Dialog

Function: boolean OpenLocalDialog ();

Description: Opens a document from a local file with the standard open file dialog.


5.        Save Documents

Function: boolean Save(BSTR strPath);

Description: Save the opened file to specify a save location.


6.        Show Save File Dialog

Function: void SaveLocalDialog();

Description: Saves a document to a local file with the standard save file dialog.


7.        Save Web Folder

Function: void SaveWebFile(BSTR ServerUrl);

Description: Saves a document to a web folder.

Note: In order to save and upload the opened file in the Edraw Viewer OCX For PowerPoint, you must write a method in your web server to receive the stream. Please review the full sample codes in the install package


private void Save()


       Stream stream = Request.InputStream;

       StreamReader sr = new StreamReader(stream);

       string uploadString = sr.ReadToEnd();





              FileStream fs = new FileStream(@"c:\Test1\test.doc",

FileMode.OpenOrCreate ,FileAccess.Write,FileShare.None);  

              byte[] _fs = Request.ContentEncoding.GetBytes(uploadString);





       catch(Exception ex)






ASP.NET:  (See  \install path\sample\ASP.NET)

protected void Page_Load(object sender, EventArgs e)


          String Action = Request.QueryString[“Action”]     

        If(Action == “savefile”{ 

string fileName = Request.QueryString["FileName"];

              if (fileName == "") fileName = "temp.ppt";


              Stream stream = Request.InputStream;

              byte[] fileByte = new byte[stream.Length];

              stream.Position = 0;

              stream.Read(fileByte, 0, fileByte.Length);


              string strTempPath = "c:\\";


              string packageFilePath = strTempPath + fileName;

              using (FileStream fileStream = new FileStream(packageFilePath, FileMode.CreateNew))


                 fileStream.Write(fileByte, 0, fileByte.Length);







PHP:  (See  \install path\sample\SaveFile.php)


/* PUT data comes in on the stdin stream */

$putdata = fopen("php://input", "r");


/* Open a file for writing */

$fp = fopen("test.ppt", "w");


/* Read the data 1 KB at a time

   and write to the file */

while ($data = fread($putdata, 1024))

  fwrite($fp, $data);


/* Close the streams */





8.        Close Document

Function: boolean Close();

Description: Closes the currently open document.


9.        Print Out

Function: void Print();

Description: Print out the document


10.    Get the toolbars’ state

Function: boolean GetToolbarsIsShow ();

Description: Get the toolbars’ state .


11.    Show or hide the toolbars

Function: void ShowToolbars(boolean bShow);

Description: Show/Hide whether toolbars should be displayed.

You can open an office document without toolbars as follow:

If OA1.GetToolbarsIsShow = True Then

OA1.ShowToolbars False


OA1.ShowToolbars True

End If


12.    Is Modified

Function boo IsDirty();

Description: Returns True/False if file has been altered or needs save.

It returns true when the document has been altered or needs save.

BOOL bDirty = OA1.IsDirty


13.    Upload and Download file

Function: 1) boolean HttpUploadFile(BSTR ServerUrl, BSTR LocalFilePath);

2) boolean HttpDownloadFile(BSTR ServerUrl, BSTR LocalFileUrl);

3) boolean FTPUploadFile(BSTR ServerUrl, BSTR LocalFilePath, BSTR UserName, BSTR Password);

4) boolean FTPDownloadFile(BSTR ServerUrl, BSTR LocalFilePath, BSTR UserName, BSTR Password);

Description: Upload and download the file with Http or FTP method.

The ActiveX Control supports upload and download file with HTTP or FTP method. 

Download file with HTTP method: 

OA1.HttpDownloadFile “”

Download file with FTP method: 

OA1.FTPDownloadFile “, “c:\Samples.doc”, “”, “”

Upload file with HTTP method: 

OA1.HttpUploadFile “”, “c:\Samples.doc”

Download file with HTTP method: 

OA1.HTTPDownloadFile “”, “c:\Samples.doc”


14.    Automating Office Document

Function: IDispatch* GetIDispatch();

Description: Returns the Automation interface of the document object.

The control also supports a property called GetIDispatch that allows you to obtain a reference to the IDispatch interface of the embedded object. From this interface you can automate the object to perform tasks, edit parts of the document, or gather information about what a user has added or removed. For example, if you have a Word document open, you can use code that resembles the following to add a line of text:

Dim oDoc As Word.Document

Set oDoc = OA1. GetIDispatch

oDoc.Content.Text = "This was added by Automation"

The ability to control the object while the object is embedded is very powerful. 


Note: Office ActiveX Control integrates with all functions of Word ActiveX, Excel ActiveX, PowerPoint ActiveX, Project OCX and Visio OCX developer by Edraw. It is an out-and-out ActiveX document container for hosting all Office documents.

Home | Products | Order | Download | Support | Exchange Link | Contact | Site Map

Copyright © 2004-2012 Office OCX. All rights reserved.