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

HttpUpload word document to server

I m facing a problem to used at below code, please help me then i can purchase this component.
http://localhost:1833/test/filename for open to server

http://localhost:1833/test/UploadAction.aspx for save to server
 
then file is not saved and made a tmp file but i want to replace this new doc file
 
i have used this code for save to server
 
function

SavetoServer()
{
if(document.OA1.IsOpened)
{

document.OA1.HttpInit();
var today = new Date();

var myGuid = (today.getMonth()+1).toString();
myGuid += today.getDate().toString();

myGuid += today.getYear().toString();

myGuid += today.getHours().toString();

myGuid += today.getMinutes().toString();

myGuid += today.getSeconds().toString();
var sFileName = myGuid + “.tmp”;
document.OA1.HttpAddPostOpenedFile (sFileName);

document.OA1.HttpPost(

http://localhost:1833/test/UploadAction.aspx“);

if(document.OA1.GetErrorCode() == 0)
{
var sPath = “Save successfully! You can download it http://localhost/” + sFileName;
window.alert(sPath);

}

}
else{
window.alert(

“Please open a document firstly!”);
}

}

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“);

broken macros in the documents

we have big problems with the alert when there are broken macros in the documents.

The alert window opens in the background and the user can’t see it.

Could you try to give the alert box the focus and bring it to front?

Disable the Office Menu

Edraw Office Viewer Components can disable the office main button and protect the opened document was modified by the end users. Only call the DisableFileCommand method in the BeforeDocumentOpen event and set the different enumerates.

boolean DisableFileCommand([in] WdUIType UIType, [in]
boolean Disable);
UIType: The enum type need to disable in the UI. WdUIType.
Disable: True to disable the command button or menu item.
enum WdUIType
{
wdUIDisalbeOfficeButton = 0x00000001,
wdUIDisalbeNew = 0x00000002,
wdUIDisalbeOpen = 0x00000004,
wdUIDisalbeUpgradeDocument = 0x00000008,
wdUIDisalbeSave = 0x00000010,
wdUIDisalbeSaveAs = 0x00000020,
wdUIDisalbeSendAsAttachment = 0x00000040,
wdUIDisalbeClose = 0x00000100,
wdUIDisalbePrint = 0x00000200,
wdUIDisalbePrintQuick = 0x00000400,
wdUIDisalbePrintPreview = 0x00000800,
wdUIDisalbeSaveAsMenu = 0x00001000,
wdUIDisalbePrepareMenu = 0x00002000,
wdUIDisalbePermissionRestrictMenu = 0x00004000,
wdUIDisalbeSendMenu = 0x00008000,
wdUIDisalbePublishMenu = 0x00010000,
wdUIDisalbeServerTasksMenu = 0x00020000,
wdUIDisalbeCopyButton = 0x00040000,
wdUIDisalbeCutButton = 0x00080000,
wdUIHideMenuHome = 0x01000000,
wdUIHideMenuInsert = 0x02000000,
wdUIHideMenuPageLayout = 0x04000000,
wdUIHideMenuReferences = 0x08000000,
wdUIHideMenuMailings = 0x10000000,
wdUIHideMenuReview = 0x20000000,
wdUIHideMenuView = 0x40000000,
wdUIHideMenuDeveloper = 0x80000000,
wdUIHideMenuAddIns = 0x00100000,
wdUIHideMenuFormat = 0x00200000,
wdUIHideMenuEdit = 0x00400000,
wdUIHideMenuTool = 0x00800000,
}WdUIType;
Note: The component disabled the Office menu, New button and Open
button in default.
DWORD dwDisableCommand = wdUIDisalbeOfficeButton |
wdUIDisalbeNew| wdUIDisalbeOpen;
The function need be set in the BeforeDocumentOpened event.
If you want to enable the three button, follow the samples.
Example
The following vb script shows how to enable the office main menu, new button and open
button.
Sub DocumentOpenedEvent ()
Edword.DisableFileCommand 1 , false ‘wdUIDisalbeOfficeButton
Edword.DisableFileCommand 2 , false ‘wdUIDisalbeNew
Edword.DisableFileCommand 4 , false ‘wdUIDisalbeOpen
End Sub
SCRIPT FOR=OA1 EVENT= DocumentOpened ()
DocumentOpenedEvent()
SCRIPT
The following vb script shows how to diable the saveas and save button.
Sub DocumentOpenedEvent ()
Edword.DisableFileCommand 16 , true ‘wdUIDisalbeSave
Edword.DisableFileCommand 32 , true ‘wdUIDisalbeSaveAs
End Sub
SCRIPT FOR=OA1 EVENT= DocumentOpened ()
DocumentOpenedEvent()
SCRIPT

Get Office Version by Office Automation

Version is the property of the word::Applicatin. Not a method. So you should do it as follow:

var app = document.OA1.GetApplication();
var version = app.Version;
window.alert(version);

reading Excel data in excel viewer component

Have you seen a primary error in your component?

I’ve downloaded you OCX component and create a routine to use it reading Excel data. In a non-formatted cell, it read perfectly. In a formatted cell, with the currency simbol, it doesn’t read nothing.

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

Inserts text content to opened Word file programmatically

boolean InsertText([in] BSTR Text, [in, optional] VARIANT
InDocPos);
Inserts text content to opened Word file.
Text: The text string need to be inserted.
InDocPos: The insert position. WdInPocPos.
enum WdInDocPos
{
wdInDocumentPosCursor = 1,
wdInDocumentPosStart = 2,
wdInDocumentPosEnd = 3 ,
}WdInDocPos;

How to go to special postion in the MS Word

Edraw Viewer Component for Word added some methods to do the office automation. The GotoItem method helps to position the cursor in MS Word document.

boolean GotoItem([in] WdGoToItem What, [in]
WdGoToDirection Which, [in, optional] VARIANT Count, [in,
optional] VARIANT Name);
Goes to the specified item in the Word document.
What: Optional Object. The kind of item to which the range or selection is moved. Can be one
of the WdGoToItem constants.
Which: Optional Object. The item to which the range or selection is moved. Can be one of the
WdGoToDirection constants.
Count: Optional Object. The number of the item in the document. The default value is 1.
Only positive values are valid. To specify an item that precedes the range or selection, use
wdGoToPrevious as the Which argument and specify a Count value.
Name: Optional Object. If the What argument is wdGoToBookmark, wdGoToComment,
wdGoToField, or wdGoToObject, this argument specifies a name.
enum WdGoToItem
{
wdGoToStart = 101,
wdGoToEnd = 102,
wdGoToBookmark = -1 ,
wdGoToComment = 6 ,
wdGoToEndnote = 5 ,
wdGoToEquation = 10 ,
wdGoToField = 7 ,
wdGoToFootnote = 4 ,
wdGoToGrammaticalError= 14 ,
wdGoToGraphic = 8 ,
wdGoToHeading= 11 ,
wdGoToLine = 3 ,
wdGoToObject = 9 ,
wdGoToPage = 1 ,
wdGoToPercent = 12 ,
wdGoToProofreadingError = 15 ,
wdGoToSection = 0 ,
wdGoToSpellingError = 13 ,
wdGoToTable = 2 ,
}WdGoToItem;
enum WdGoToDirection
{
wdGoToAbsolute = 1,
wdGoToFirst = 1,
wdGoToLast = -1 ,
wdGoToNext = 2 ,
wdGoToPrevious = 3 ,
wdGoToRelative = 2 ,
}WdGoToDirection;
Example
The following java script shows how to go to the file end.
function GoToItem_Example ()
{
Edword.GoToItem( 102, 1 );
}