Office OCX & Office Component

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

Edraw ActiveX Viewer for Word

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

Support Office 97, Office 2000, Office XP, Office 2007 or Office 2010 in Windows OS.

Download link:

Sales online:

 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 also get the full c++ source codes.

 Code a solution using the word control

Note: The install package includes some sample codes written with visual c++ 6.0, visual basic, Delphi, c++ builder, C#, ASP.Net, php and so on.

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();

Description: Creates a new word document.


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.        Save As

Function: boolean SaveAs(BSTR strPath, long nFileType);

Description: Save the opened file to common word document formats.

Office Document Type:

enum WdSaveFormat


    wdFormatDocument = 0,

    wdFormatTemplate = 1,

    wdFormatText = 2,

    wdFormatTextLineBreaks = 3,

    wdFormatDOSText = 4,

    wdFormatDOSTextLineBreaks = 5,

    wdFormatRTF = 6,

    wdFormatUnicodeText = 7,

    wdFormatEncodedText = 7,

    wdFormatHTML = 8,

    wdFormatWebArchive = 9,

    wdFormatFilteredHTML = 10,

    wdFormatXML = 11


If you want to save the opened word document into the html format, you can write codes as follow:

OA1. SaveAs “c:\1.html”, 10


7.        Show Save File Dialog

Function: void SaveLocalDialog();

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


8.        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 PowerPoint Viewer ActiveX Control, you must write a method in your web server to receive the stream. Please review the full sample codes in the install package


9.        Close Document

Function: boolean Close();

Description: Closes the currently open document.


10.    Read-Only Word document

Function: void SetReadOnly(boolean bReadOnly);

Description: Set the read-only state

It is possible to change the viewer in a way it can only view the word documents.

OA1.SetReadOnly true

It is possible to change the viewer in a way it can edit the word documents.

OA1.SetReadOnly false


11.    Print Out

Function: void Print();

Description: Print out the document


12.    Get the toolbars’ state

Function: boolean GetToolbarsIsShow ();

Description: Get the toolbars’ state .


13.    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


14.    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


15.    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”

Note: you must write a Stream receive method in the server.  

Download file with HTTP method: 

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


16.    Switch to the Read Mode

Function: void SwitchToReadMode ();

Description: Switch the opened file into the read mode..


17.    Switch to the Normal View

Function: void SwitchToNormalView ();

Description: Switch the opened file into the normal view .


18.    Switch to the Page View

Function: void SwitchToPageView ();

Description: Switch the opened file into the Page view..


19.    Switch to the Web View

Function: void SwitchToWebView ();

Description: Switch the opened file into the Web view..


20.    Go to Page

Function: GotoPage(short pageNum);

Description: Go to the appointed page .


21.    Open the Standard Dialog in the MS Word

Function: void ShowWordStandardDialog (short nDialogType);

Description: Open the standard dialog in the MS Word. .

The follow codes can open the Find dialog: 

OA1. ShowWordStandardDialog(112);

The follow codes can open the summary information dialog: 

OA1. ShowWordStandardDialog(86);

You can visit to see all the enumeration values.


22.    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.

Review how to insert an image into word. (VC Codes)


lpDisp = m_pOA->GetIDispatch();


//Add text to the first line of the document

_Document m_WordDoc;


//set _Document doc to use lpDisp, the IDispatch* of the

//actual document.


Shape m_wordShape;

Shapes m_wordShapes;



COleVariant vTrue((short)TRUE),vFalse((short)FALSE);


CString m_strPath;

char exeFullPath[MAX_PATH];



int ndx = m_strPath.ReverseFind ('\\');

m_strPath = m_strPath.Left (ndx);

CString filename = m_strPath + "\\test.bmp";


_Application m_WordApp;


m_wordShapes  = m_WordDoc.GetShapes();

CString FileName =filename;



InlineShapes m_WordInlineShapes;

InlineShape m_WordInlineShape;

Selection m_WordSelection;




m_WordInlineShape = m_WordInlineShapes.AddPicture(FileName,vFalse,vTrue,vOpt);


m_wordShape = m_WordInlineShape.ConvertToShape();


Shapes shs;

Shape shp;








ShapeRange m_wordShapeRange;

WrapFormat m_wordWrapFormant;


m_WordApp = m_WordDoc.GetApplication();


m_wordShape = m_WordSelection.GetShapeRange();

m_wordWrapFormant = m_wordShape.GetWrapFormat();




PictureFormat m_wordPictureFormat = m_wordShape.GetPictureFormat();




FillFormat m_wordFillFormat  = m_wordShape.GetFill();














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>>

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

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