|
PowerPoint Viewer OCX v3.1 |
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.
Home:
http://www.officeocx.com
Online Demo:
http://www.officeocx.com/PowerPoint-Viewer-Online-Demo.htm
Support Mail:
support@officeocx.com
Sales online:
https://www.regnow.com/softsell/nph-softsell.cgi?item=14203-4
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 also
get the full c++ source codes.
Name: PowerPoint Viewer OCX
or PowerPoint ActiveX Control
CLSID:
97AF4A45-49BE-4485-9F55-91AB40F22B92
Version: 3,1,0,3
Release Date: 2006-9-14
OCX Size: 464KB
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();
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 from an 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
"http://www.officeocx.com/demo/sample.ppt"
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 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.doc",
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
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);
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.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 */
fclose($fp);
fclose($putdata);
?>
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
Else
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
Else
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 “http://www.officeocx.com/demo/Samples.doc”
Download file with
FTP method:
OA1.FTPDownloadFile “http://www.officeocx.com/demo/Samples.doc,
“c:\Samples.doc”, “”, “”
Upload file with
HTTP method:
OA1.HttpUploadFile “http://www.officeocx.com/demo/SaveFile.aspx?Action=’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 “http://www.officeocx.com/demo/Samples.doc”,
“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:
COleVariant
vOpt(DISP_E_PARAMNOTFOUND, VT_ERROR);
m_pOA->CreateNew();
LPDISPATCH lpDisp;
lpDisp = m_pOA->GetIDispatch();
_Presentation
oPres;
oPres.AttachDispatch(lpDisp);
_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;
oCells.Delete(vOpt);
vCell =
oCells.GetItem(COleVariant((short)1), COleVariant((short)2));
oCell.AttachDispatch(vCell.pdispVal);
oCell.SetValue(COleVariant("John"));
vCell =
oCells.GetItem(COleVariant((short)2), COleVariant((short)2));
oCell.AttachDispatch(vCell.pdispVal);
oCell.SetValue(COleVariant((short)520));
vCell =
oCells.GetItem(COleVariant((short)1), COleVariant((short)3));
oCell.AttachDispatch(vCell.pdispVal);
oCell.SetValue(COleVariant("Sue"));
vCell =
oCells.GetItem(COleVariant((short)2), COleVariant((short)3));
oCell.AttachDispatch(vCell.pdispVal);
oCell.SetValue(COleVariant((short)660));
vCell =
oCells.GetItem(COleVariant((short)1), COleVariant((short)4));
oCell.AttachDispatch(vCell.pdispVal);
oCell.SetValue(COleVariant("Bill"));
vCell =
oCells.GetItem(COleVariant((short)2), COleVariant((short)4));
oCell.AttachDispatch(vCell.pdispVal);
oCell.SetValue(COleVariant((short)690));
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
oChart.SetHasTitle(TRUE);
MSGraph::ChartTitle oChartTtl = oChart.GetChartTitle();
oChartTtl.SetText("ACME Corporation");
//Save changes to
the chart and close MSGraph
oGraphApp.Update();
oGraphApp.Quit();
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 OCX enables your application to display and interact
with all Microsoft Word documents with Read-Only or Edit
properties.
Excel Viewer OCX
– Excel
Viewer OCX enables your application to display and interact
with all Microsoft Excel sheet with Read-Only or Edit
properties. Support some important excel automating
interfaces. It’s very easy to customize your own programs.
PowerPoint Optimizer - compress presentation by up to 95%! |