Play slideshow in the same window

EDraw Office Viewer Component provides a solution for opening then playing the slideshow file in the same window. Of course you can play it with full screen mode too.

Simply call the “SlideShowOpenAndPlay” method, you can get the follow effect immediately.

PowerPoint Viewer ActiveX Control

You can show or hide the titlebar, screenbar, toolbar too.

You can call it via javascript or vbscript in your html page as follow.

document.OA1.SlideShowOpenAndPlay(”http://www.ocxt.com/demo/samples/sample.ppt“, false, false, false, false);

OR:

OA1.Open(”http://www…./sample.pps“, “PowerPoint.Slide”);

OA1.SlideShowPlay(false, false, true, false);

[id(99), helpstring("Opens then plays the PowerPoint slide show file in the same window or full screen.")]
HRESULT SlideShowOpenAndPlay([in] VARIANT Document, [in] VARIANT_BOOL bFullScreen, [in] VARIANT_BOOL bShowWebToolbar, [in] VARIANT_BOOL bLoopUntilStopped, [in] VARIANT_BOOL bShowScrollBar, [in, optional] VARIANT WebUsername, [in, optional] VARIANT WebPassword);

[id(100), helpstring("Plays the PowerPoint slide show file in the same window or full screen.")]
HRESULT SlideShowPlay([in] VARIANT_BOOL bFullScreen, [in] VARIANT_BOOL bShowWebToolbar, [in] VARIANT_BOOL bLoopUntilStopped, [in] VARIANT_BOOL bShowScrollBar);

How to verify whether the open document is modified

If you are developing the destop application with the office viewer component, you can use the “IsDirty” method to verify whether the open document is modified. When the open file has any modification, the IsDirty method return TRUE. After you save the document, the IsDirty return False again.

But if you are developing the web application, you need to add some extra codes. Because you are opening a file from remote server and the component can’t watch the file like destop application.

A good method is set another variable in your application. When you save the document, you set the variable true. Any time you can judge the dirty by the IsDirty method and your own variable.

BOOL GetIsDirty(){

if(OA.IsDirty()==Flase) return False;

else return m_bDirty;

}

event OnDocumentOpened() 

{ 

m_bDirty = false; 

}

function UploadFile()

{

……

m_bDirty = False;

}

Enumerate the menu name in MS Office

Sub ListShortCutMenus()
Cells.Clear
Application.ScreenUpdating = False
Row = 1
For Each cbar In CommandBars
If cbar.Type = msoBarTypePopup Then
Cells(Row, 1) = cbar.Index
Cells(Row, 2) = cbar.Name
For col = 1 To cbar.Controls.Count
Cells(Row, col + 2) = _
cbar.Controls(col).Caption
Next col
Row = Row + 1
End If
Next cbar
Cells.EntireColumn.AutoFit
End Sub

Solved the “Click to activate and user the control”

Users cannot directly interact with ActiveX controls loaded by the APPLET, EMBED, or OBJECT elements. Users can interact with such controls after activating their user interfaces. This topic describes how Microsoft Internet Explorer handles ActiveX controls, shows how to load ActiveX controls so their interfaces are activated, and describes the impact of this behavior on accessibility tools and applications hosting the WebBrowser Control.

To activate an interactive control, either click it or use the TAB key to set focus on it and then press the SPACEBAR or the ENTER key. Interactive controls loaded from external script files immediately respond to user interaction and do not need to be activated.

To create Web pages that load interactive controls that respond immediately to user input, use Microsoft JScript to load controls from external script files. You cannot write script elements inline with the main HTML page to load your control externally. If the script is written inline programmatically, for example with the writeln function, the loaded control will behave as if it was loaded by the HTML document itself and will require activation. To ensure a control is interactive when it is loaded, use one of the following techniques to load your control from an external file.

We have provide a solution to activate the Office Viewer Component automatically when loading a page.

OADemo.php

<object classid=”clsid:6BA21C22-53A5-463F-BBE8-5CF7FFA0132B” id=”OA1″ width=”674″ height=”500″ ….
</object>
<script language=”JavaScript” type=”text/javascript” src=”NoIEActivate.js”></script>

NoIEActivate.js

n=navigator.userAgent;
 w=n.indexOf(”MSIE”);
 if((w>0)&&(parseInt(n.charAt(w+5))>5)){
 T=["object","embed","applet"];
 for(j=0;j<2;j++){
 E=document.getElementsByTagName(T[j]);
 for(i=0;i<E.length;i++){
 P=E[i].parentNode;
 H=P.innerHTML;
 P.removeChild(E[i]);
 P.innerHTML=H;
 }}}

Javascript for Office Viewer Component

We have written a demo page with javascript. Anybody can visit it at

http://www.ocxt.com/oademo_javascript.php

You can find all the sample projects in the install directory.