Office OCX & Office Component

Office Viewer OCX, Word Viewer OCX, Excel Viewer  OCX and PowerPoint Viewer OCX!

Excel Viewer OCX

Excel Viewer OCX acts as an ActiveX document container for hosting Excel 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.

Home: http://www.officeocx.com

Online Demo: http://www.officeocx.com/ Excel-Online-Demo.htm

Support Mail: support@officeocx.com

Sales online: https://www.regnow.com/softsell/nph-softsell.cgi?item=14203-3

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

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: Excel Viewer OCX or Excel Viewer ActiveX Control

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

Version: 3,2,0,5

Release Date: 2007-3-31

OCX Size: 472KB

Screenshot:

Excel Component - Excel OCX

 

How to add Excel Viewer OCX to your Visual Basic 6.0 project 

1.       From the Project Menu select Components…

2.       Select control “Excel 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.

 

How to add Excel Viewer OCX to your Access Form

1. Open Access

2. Create a new blank database

3. Create a new form in Design View. You should now be in design mode

4. From the Insert Menu select "ActiveX Control..."

5. Select Office Viewer ActiveX Control and click the OK Button

6. The control should appear on the form

7. Resize and move the control on the form as desired

8. Add a button to the form. If the wizard appears cancel it

9. Right-click on the button to invoke the popup menu

10. Select "Build Event..." then select Code Builder and click OK Button

11. You should be inside the Visual Basic Development Environment

12. Within the Command_Click enter the following code:

Note: Modify code to point to an existing Word Document file on your web server

EXCEL1.OpenWebFile "http://www.officeocx.com/demo/Sample.xls"

 

13. Save your changes and close Visual Basic

14. Save the form and close it

15. Double-click on the form to run it.

16. Click the button. The Word Document should appear!

17. Experiment by changing the file path to a local file such as:

EXCEL1.Open "c:\temp\Sample.xls"

EXCEL1.ShowToolbars False

 

You can referent some sample codes in the install category.

 

Code a 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 documents

Function void CreateNew()

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.

EXCEL1. OpenWebFile "http://www.officeocx.com/demo/Sample.xls"

 

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

ASP:

private void Save()

{

       Stream stream = Request.InputStream;

       StreamReader sr = new StreamReader(stream);

       string uploadString = sr.ReadToEnd();

       sr.Close();

       stream.Close();

       try

       {

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

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

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

              fs.Write(_fs,0,_fs.Length);

              fs.Flush();

              fs.Close();

       }

       catch(Exception ex)

       {

              Response.Write(ex.ToString());

       }

}            

 

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.xls";

 

              Stream stream = Request.InputStream;

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

              stream.Position = 0;

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

              stream.Close();

              string strTempPath = "c:\\";

       

              string packageFilePath = strTempPath + fileName;

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

              {

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

                 fileStream.Flush();

                 fileStream.Close();

             }

}

    }             

 

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

<?php

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

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

 

/* Open a file for writing */

$fp = fopen("test.xls", "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 */

fclose($fp);

fclose($putdata);

?>

 

8.        Close Document

Function: boolean Close();

Description: Closes the currently open document.

 

9.        Print Out

Function: void PrintOut();

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 EXCEL1.GetToolbarsIsShow = True Then

EXCEL1.ShowToolbars False

Else

EXCEL1.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 = EXCEL1.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: 

EXCEL1.HttpDownloadFile “http://www.officeocx.com/demo/Samples.xls”

Download file with FTP method: 

EXCEL1.FTPDownloadFile “http://www.officeocx.com/demo/Samples.xls, “c:\Samples.xls”, “”, “”

Upload file with HTTP method: 

EXCEL1.HttpUploadFile “http://www.officeocx.com/demo/SaveFile.php”, “c:\Samples.xls”

Download file with HTTP method: 

EXCEL1.HTTPDownloadFile “http://www.officeocx.com/demo/Samples.xls”, “c:\Samples.xls”

 

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:

LPDISPATCH lpDisp;

lpDisp = m_pOA->GetIDispatch();

      

//Add text in cell A1 of the embedded Excel sheet

_Workbook wb;

Worksheets wsSet;

_Worksheet ws;

Range range;

_Application app;

//set _Workbook wb to use lpDisp, the IDispatch* of the actual workbook.

wb.AttachDispatch(lpDisp);

//Then get the worksheet's application.

app = wb.GetApplication();

//Then get the first worksheet in the workbook

wsSet = wb.GetWorksheets();

ws = wsSet.GetItem(COleVariant((short)1));

//From there, get a Range object corresponding to cell A1.

range = ws.GetRange(COleVariant("A2"), COleVariant("A2"));

range.SetValue(COleVariant("Office ActiveX!"));

ws.ReleaseDispatch();

wb.ReleaseDispatch();

app.DetachDispatch();

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

 

Other Office ActiveX Controls

Office Viewer ActiveX Control – Office Viewer ActiveX Control enables your application to display and interact with all Microsoft Office files such as Word, Excel, PowerPoint, Project and Visio! Simply place the OCX on your form, then you can have all the office functions immediately. Support Office automating client to custom your application. Include abundant sample codes.

Word Viewer OCX Word Viewer ActiveX Control acts as an ActiveX document container for hosting Word documents in a custom form or Web page. It solved the requirement to show a word document on a web form and the user can change the document and the changes should be saved to web server. It is possible to change the viewer in a way it can only read-only or edit state.  

PowerPoint Viewer OCX –PowerPoint Viewer OCX enables your application to play the slideshow file in a form or a web site.

 

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

Documents>>
What's new in the EDraw Office Viewer Component
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-2008Office OCX. All rights reserved.