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 do the office automation in Delphi

We want to use this component to pilot Word and Visio documents, but we have certain problems and I would like to ask you some questions :

In Word, I use bookmarks to automatically insert data, like date, name of the user. To do this, in my code I use WordGotoItem function :

    OfficeViewer_1.WordGotoItem(wdGoToBookmark, wdGoToFirst, 1, ‘Name’);

but it doesn’t work, and I don’t know why.

Could you give me more information about this function and what’s wrong in my code ?

And I have another question :

How do I reach the header or footer of the word document ? Is there a function ?

 

Edraw Office Viewer Component can work in Delphi 2007/2009 for the office automation.

For example:
 
var
p1,p2: OleVariant;
OleAPP,OleDoc,MenuBar: OleVariant;
begin
  OfficeViewer.Toolbars:=FALSE; 
  OfficeViewer.Titlebar:=FALSE;
  p1:=DocFileName;
  p2:=TRUE;
  OfficeViewer.Open(DocFileName);
  OleDoc:=OfficeViewer.ActiveDocument; // IDispatch Document
  OleAPP:=OleDoc.application; // IDispatch Document.application
  // ——— WORD —————————————
  OleAPP.ActiveWindow.DisplayRulers := False;
  OleAPP.ActiveWindow.View.Type := 1; // wdNormalView=1
  // no popup
  oleDoc.CommandBars['Text'].Enabled := False;
  try
   OleDoc.Protect(1,Null,’ppkLock’);
  except
  end;
end;

Open MS Word or Excel Stream in JSP Program

In order to avoid the temporary file in the server, edraw office  viewer component provided a httpopenfilefromstream method to open the office document from file stream directly. It works in the JSP environment.

For example:

Getfile.jsp example code:

String downloadDirName = request.getSession().getServletContext().getRealPath(DOWNLOAD_RELATIVE_PATH);
 String downloadFileName = downloadDirName + “/” + fileMap.get(PARAM_DOCUMENT_ID).getString();
 File downloadFile = new File(downloadFileName);
 if (downloadFile.exists()) {
  byte[] buffer = new byte[4096];
  BufferedOutputStream output = null;
  BufferedInputStream input = null;
  try {
   output = new BufferedOutputStream(response.getOutputStream());
   input = new BufferedInputStream(new FileInputStream(downloadFileName));
   output.write(”EDA_STREAMBOUNDARY”.getBytes());
   int n = -1;
   while ((n = input.read(buffer, 0, buffer.length)) > -1) {
    output.write(buffer, 0, n);
   }
   output.write(”EDA_STREAMBOUNDARY”.getBytes());
   output.flush();
  } catch(Exception e) {
   e.printStackTrace();
  } finally {
   if (output != null) output.close();
   if (input != null) input.close();
  }
 }
 else {
  System.out.println(”[OfficeViewer Error] 404 File not found!”);
  System.out.println(fileItemList.toString());
 }

Open example code:

$(”OA1″).HttpInit();
$(”OA1″).HttpAddpostString(”DocumentID”, “sample.doc”);
$(”OA1″).HttpOpenFileFromStream(”http://192.168.1.1:8020/path/getfile.jsp“);

Is there a way to run ActiveX components in Firefox?

Is there a way to run ActiveX components in Firefox through the use of a plugin?

I seem to have found a solution:

http://code.google.com/p/ff-activex-host/

“This Firefox plugin makes it possible to use ActiveX controls in Firefox. It is based on the Gecko NPAPI and provides full access to the hosted control (events, functions, properties).”

Other ActiveX plug-in that works. It is called neptune. See for more info http://www.meadroid.com/neptune/index.htm

Replace words in Office ActiveX Control

In my ASPX page I want to find and replace some predefined words. I am
using the following code, but it say objWord.Selection is not there. (
where as this is supported by word )
Set objWord = document.OA1.ActiveDocument
Set objSelection = objWord.Selection
objSelection.Find.ClearFormatting
objSelection.Find.Replacement.ClearFormatting
objSelection.Find.Text = varFind
objSelection.Find.Replacement.Text = varReplace
objSelection.Find.Forward = True
objSelection.Find.Wrap = wdFindContinue
objSelection.Find.Format = False
objSelection.Find.MatchCase = False
objSelection.Find.MatchWholeWord = False
objSelection.Find.MatchWildcards = False
objSelection.Find.MatchSoundsLike = False
objSelection.Find.MatchAllWordForms = False
objSelection.Find.Execute
Please let me know how can I find and replace word in the client side
word with OA1 activeX.

How to disable the file command buttons

The Office Viewer Component provides the method “EnableFileCommand” to allow the developers to disable the File command in the MS office program.

If you are developing a web application, you can set the initial functions in the “NotifyCtrlReady” event.

function OA1_NotifyCtrlReady() {
document.OA1.EnableFileCommand(0) = false; //FileNew = 0
}
<SCRIPT LANGUAGE=javascript FOR=OA1 EVENT=NotifyCtrlReady>
<!–
OA1_NotifyCtrlReady();
//–>
</SCRIPT>

More File Command ENUMS:

typedef enum FileCommandType
{
FileNew = 0,
FileOpen,
FileClose,
FileSave,
FileSaveAs,
FilePrint,
FilePageSetup,
FileProperties,
FilePrintPreview
} FileCommandType;

Edraw Office Viewer Component 5.3.407 Released

5.3.407.1 version is a maintenance update.

1. Provided the silent print for the MS office document.

2. Added WordGetCurrentPageIndex and WordGetTotalPageCounts to return the current page number and page counts in Word document. 

3. The ExcelGetCellValue won’t returns null when the date is numeric;

4. Supported to open an Office 2007 file from the remote server with the “Open” method directly.

5.3.288.1

1. Fixed the buffer overflow to execute arbitrary code via a long first argument to the HttpDownloadFileToTempDir method and FTPDownloadFile.

2. Solved the failture when saving an Excel document to the server and having a cell activated.

3. Removed the default overwrite reminder from Microsoft Excel if you save an open Excel file at the same position multiple times.

4. Solved: Return to the first page if you click the Document Map in a protected Microsoft Word document

5. Solved: The excel process keeps back when call the “OfficeProtectDocument” method.

6. Some other small improvements.

How to upgrade the activex control in your program

After uninstall the old version and install the upgrade version, follow steps.

For HTML, PHP, ASp, JSP, ASP.NET application, you need change the version number in the Object tag.

<object classid=”clsid:6BA21C22-53A5-463F-BBE8-5CF7FFA0132B” id=”OA1″ width=”674″ height=”500″ codebase=”http://www.ocxt.com/download/officeviewer.cab#6,0,612,1“>

For VC project, you need go to the form and delete the component. Then delete the OfficeViewer1.h and OfficeViewer1.cpp file from your project. Save project then add the Edraw Office Viewer Component from the Toolbox. Then create a blank VC project based on Dialog. Add Edraw office Viewe Component to the Toolbox. Drag it to the dialog. Add variable for the component. You can find the OfficeViewer1.h and OfficeViewer1.cpp file in the new project. Copy the two files to your exsit project. Add exsit items…

For VB project, you need modify these files.

In OfficeViewer.frm

Object = “{F6F03022-1646-4426-A912-1F26464E81AB}#6.0#0″; “officeviewer.ocx”

In OfficeViewer.vbp

Object={F6F03022-1646-4426-A912-1F26464E81AB}#6.0#0; officeviewer.ocx

For C# or VB.NET project, you need delete the component from your form. Then delete the AxOfficeViewer and OfficeViewer references. Then right click the Toolbox and choose item… In the popup Choose Toolbox Items dialog click the COM Component. Then click the Browse… In the Edraw Office Viewer  component install folder, choose the officeviewer.ocx. Then click OK. Drag the component to your form.

Microsoft Word right-click menu doesn’t work

The combination of IE7 and Microsoft Word 2007 results in the failure of the Microsoft Word right-click menu.  The right-click menu starts to come up, and then it immediately disappears. I tested this on multiple web clients and they all had the same problem.

The MS Word right-click menu works with older versions of IE and older versions of MS Word, but the combination of IE7 and MS Word 2007 seems to cause the right-click MS Word menu to fail.

ActiveX controls running in the IE process cannot install updates themselves

When IE is in Protected Mode on Windows Vista, ActiveX controls running in the IE process cannot install updates themselves. This is because IE and ActiveX controls do not have write access to most locations in the file system or registry under Protected Mode. As a result, it’s best to use a separate executable to download and install the update. You can further protect users against “man-in-the-middle” attacks by using an SSL connection to download updates. For more information on Protected Mode see the technical article Understanding and Working in Protected Mode.

Similar to the initial install process, your executable will need administrative privileges to install updates for all users on the machine.  To request administrative privileges on Windows Vista, create an application manifest for your executable with the following requested execution level:

<requestedExecutionLevel
level=”requireAdministrator”/>

Note that Windows Vista will see the requested execution level and display a User Account Control (UAC) dialog so the user can elevate the update executable out of Protected Mode.