Office OCX & Office Component

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

Edraw Viewer For PowerPoint

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

Download link:

Sales online:

Support Office 97, Office 2000, Office XP, or Office 2003, 2007, 2010 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 also get the full c++ source codes.  

Name: Edraw Viewer OCX For PowerPoint

Code a PowerPoint solution using the 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 PowerPoint documents

Function void CreateNew();

Description: Creates a new PowerPoint document.


2.        Open Local PowerPoint file

Function: boolean Open(BSTR Path);

Description: Opens a slideshow 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 PowerPoint file from a URL

Function: boolean OpenWebFile(BSTR FileUrl);

Description: Opens a PowerPoint file from a web folder.

You can also open and edit PowerPoint files 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 PowerPoint file 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 to Web Server

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 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://stdin", "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 */





You can also write the stream receive method with other language in the server.


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 .

You can open an office document without toolbars as follow:

If OA1.GetToolbarsIsShow = True Then

OA1.ShowToolbars False


OA1.ShowToolbars True

End If


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.    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 “’save’&Name=’temp.ppt’”, “c:\Samples.doc”

Note: you must write a Stream receive method in the server. Review the above the sample codes.

Download file with HTTP method: 

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


13.    Play Slide Show in the same window

Function: void ShowSlide ();

Description: Play powerpoint slideshow in the same window.


14.    Run Slide Show in full screen mode

Function: void Run ();

Description: Run slide show in full screen mode.


15.    Switch to the edit view

Function: void ShowSlideEditView ();

Description: Switch to the edit view.


16.    Switch to the Outline view

Function: void ShowSlideOutlineView ();

Description: Switch to the outline view.


17.    Switch to the Master view

Function: void ShowSlideMasterView ();

Description: Switch to the master view.


18.    Switch to the Sorter view

Function: void ShowSlideSorterView ();

Description: Switch to the sorter view.


19.    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:




lpDisp = m_pOA->GetIDispatch();

_Presentation oPres;



_Application oApp = oPres.GetApplication();

Presentations oPresSet = oApp.GetPresentations();

Slides oSlides = oPres.GetSlides();

_Slide oSlide = oSlides.Add(1, 1);  //ppLayoutTitle = 1

Shapes oShapes = oSlide.GetShapes();

Shape oShape = oShapes.Item(COleVariant("Rectangle 2"));

TextFrame oTxtFrm = oShape.GetTextFrame();

TextRange oTxtRng = oTxtFrm.GetTextRange();

oTxtRng.SetText("Automating PowerPoint");


oShape = oShapes.Item(COleVariant("Rectangle 3"));

oTxtFrm = oShape.GetTextFrame();

oTxtRng = oTxtFrm.GetTextRange();

oTxtRng.SetText("To Create and View a SlideShow");


oSlide = oSlides.Add(2, 12); //ppLayoutBlank = 12

oShapes = oSlide.GetShapes();

oShape = oShapes.AddOLEObject(20, 20, 660, 500, "MSGraph.Chart",

                                  "", 0, "", 0, "", 0);


//Get the Chart object so that you can automate MSGraph

OLEFormat oOLEFmt = oShape.GetOLEFormat();

MSGraph::Chart oChart = oOLEFmt.GetObject();

MSGraph::Application oGraphApp = oChart.GetApplication();


//Modify the chart's datasheet

MSGraph::DataSheet oData = oGraphApp.GetDataSheet();

MSGraph::Range oCells = oData.GetCells();

MSGraph::Range oCell;

COleVariant vCell;



vCell = oCells.GetItem(COleVariant((short)1), COleVariant((short)2));



vCell = oCells.GetItem(COleVariant((short)2), COleVariant((short)2));



vCell = oCells.GetItem(COleVariant((short)1), COleVariant((short)3));



vCell = oCells.GetItem(COleVariant((short)2), COleVariant((short)3));



vCell = oCells.GetItem(COleVariant((short)1), COleVariant((short)4));



vCell = oCells.GetItem(COleVariant((short)2), COleVariant((short)4));



oChart.SetChartType(5); //xlPie = 5

MSGraph::PlotArea oPlot = oChart.GetPlotArea();

MSGraph::Border oBrdr = oPlot.GetBorder();

oBrdr.SetLineStyle(COleVariant((long)-4142));//xlLineStyleNone = 4142


MSGraph::Legend oLegend = oChart.GetLegend();

oLegend.SetPosition((long)(-4107)); //xlLegendPositionBottom = -4107



MSGraph::ChartTitle oChartTtl = oChart.GetChartTitle();

oChartTtl.SetText("ACME Corporation");


//Save changes to the chart and close MSGraph



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 | Developer | Support | Exchange Link | Contact | Site Map

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