com.acesoft.aceoffix
Class AceoffixCtrl

java.lang.Object
  extended by com.acesoft.aceoffix.AceoffixCtrl

public class AceoffixCtrl
extends java.lang.Object

AceoffixCtrl class is the heart among all Aceoffix classes, which is in charge of online opening, displaying and editing the Office document.

Version:
5.0
Author:
Acesoft Corporation

Constructor Summary
AceoffixCtrl(HttpServletRequest request)
          Initializes a new instance of the AceoffixCtrl class.
 
Method Summary
 void addCustomMenuItem(java.lang.String caption, java.lang.String jsFunction, boolean enabled)
          Adds a menu item to custom menu.
 void addCustomToolButton(java.lang.String caption, java.lang.String jsFunction, int iconIndex)
          Adds a button to custom tool bar.
 void bind(java.lang.Object writerObj)
          Binds the data source object to the AceoffixCtrl.
 void createNewDocument(java.lang.String userName, DocumentVersion docVersion)
          Creates a new document and open it for editing online.
 RibbonToolbar getRibbonBar()
          Gets the Ribbon bar object to customize the Ribbon toolbar of Office2007/2010/2013/2016.
 void openDocument(java.lang.String documentURL, OpenModeType openMode, java.lang.String userName)
          Opens an Office document online.
 void setAllowCopy(boolean value)
          Sets a value that indicates whether Copy, Paste and Download are allowed in the current document.
 void setBorderColor(java.awt.Color value)
          Sets the border color of AceoffixCtrl.
 void setBorderStyle(BorderStyleType value)
          Sets the border style of AceoffixCtrl.
 void setCaption(java.lang.String value)
          Sets the caption text for AceoffixCtrl.
 void setCompressDocument(boolean value)
          Sets a value that indicates whether the document will be compressed when AceoffixCtrl saving document.
 void setCustomMenuCaption(java.lang.String value)
          Sets the caption of custom menu.
 void setCustomToolbar(boolean value)
          Sets a value that indicates whether the custom tool bar of AceoffixCtrl shows.
 void setEnableUserProtection(boolean value)
          Indicates whether the document protection set by user will be enabled.
 void setFileTitle(java.lang.String value)
          The default file name of the Save As dialog box prompted by AceoffixCtrl at the client side.
 void setHTTPBasic_Password(java.lang.String value)
          The password used in HTTP Basic Authentication.
 void setHTTPBasic_UserName(java.lang.String value)
          The user name used in HTTP Basic Authentication.
 void setInstallationHint(java.lang.String value)
          Customize installation hint of Acoeffix at client side.
 void setJsFunction_AfterDocumentClosed(java.lang.String value)
          Sets a JavaScript function for AfterDocumentClosed event.
 void setJsFunction_AfterDocumentOpened(java.lang.String value)
          Sets a JavaScript function for AfterDocumentOpened event.
 void setJsFunction_AfterDocumentSaved(java.lang.String value)
          Sets a JavaScript function for AfterDocumentSaved event.
 void setJsFunction_BeforeDocumentClosed(java.lang.String value)
          Sets a JavaScript function for BeforeDocumentClosed event.
 void setJsFunction_BeforeDocumentSaved(java.lang.String value)
          Sets a JavaScript function for BeforeDocumentSaved event.
 void setJsFunction_OnExcelCellClick(java.lang.String value)
          Sets a JavaScript function for OnExcelCellClick event.
 void setJsFunction_OnWordDataRegionClick(java.lang.String value)
          Sets a JavaScript function for OnWordDataRegionClick event.
 void setMenubar(boolean value)
          Sets a value that indicates whether the menu bar of AceoffixCtrl shows.
 void setMenubarColor(java.awt.Color value)
          Sets the back color of the menu bar of the AceoffixCtrl.
 void setMenubarTextColor(java.awt.Color value)
          Sets the text color of the menu bar of AceoffixCtrl.
 void setOfficeToolbars(boolean value)
          Sets a value that indicates whether the tool bars of Microsoft Office shows.
 void setProtectPassword(java.lang.String value)
          Sets protection password for the current Word or Excel document when the document has a protection password.
 void setSaveDataPage(java.lang.String saveDataPage)
          Sets a value that indicates with which page developers would like to receive and save the data sent by AceoffixCtrl.
 void setSaveFileMaxSize(int value)
          Sets the max size of saving document by AceoffixCtrl, in bytes.
 void setSaveFilePage(java.lang.String saveFilePage)
          Sets a value that indicates with which page developer would like to receive and save the document sent by AceoffixCtrl.
 void setServerPage(java.lang.String serverPage)
          Sets a value that indicates the URL of Aceoffix server page.
 void setTagId(java.lang.String id)
          This method is very important.
 void setTheme(ThemeType value)
          Sets the theme of the AceoffixCtrl.
 void setTimeSpan(int value)
          Sets the time span of concurrency control, in minutes.
 void setTitlebar(boolean value)
          Sets a value that indicates whether the title bar of the AceoffixCtrl shows.
 void setTitlebarColor(java.awt.Color value)
          Sets the back color of the title bar of the AceoffixCtrl.
 void setTitlebarTextColor(java.awt.Color value)
          Sets the text color of the title bar of the AceoffixCtrl.
 void setVisible(boolean value)
          Sets a value that indicates whether AceoffixCtrl is visible when it is running.
 void wordCompare(java.lang.String documentURL, java.lang.String documentURL2, OpenModeType openMode, java.lang.String userName)
          Compares two different Word documents online.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AceoffixCtrl

public AceoffixCtrl(HttpServletRequest request)
Initializes a new instance of the AceoffixCtrl class.

Method Detail

setTagId

public void setTagId(java.lang.String id)
              throws java.lang.Exception,
                     java.io.IOException
This method is very important. You have to call it at the end of the Java code of AceoffixCtrl.

The following example shows how to open a Word document online.

 AceoffixCtrl aceCtrl1 = new AceoffixCtrl(request);
 //Set the server page of AceoffixCtrl.
 aceCtrl1.setServerPage("server.ace"); // Required
 
 //Set UI theme.
 aceCtrl1.setCaption("test.doc");
 aceCtrl1.setTheme(ThemeType.Office2010);
 aceCtrl1.setBorderStyle(BorderStyleType.BorderFlat);
 
 //Hide menu bar. 
 aceCtrl1.setMenubar(false);
 //Hide Office tool bars.
 aceCtrl1.setOfficeToolbars(false);
 
 //Set the page for saving the current document.
 aceCtrl1.setSaveFilePage("savefile.jsp");
 //Open a Word document with OpenModeType.docNormalEdit mode.
 aceCtrl1.openDocument("doc/test.doc", OpenModeType.docNormalEdit, "John Scott");
 aceCtrl1.setTagId("AceoffixCtrl1");
 

Parameters:
id - The id is in the HTML code where the tag of AceoffixCtrl is. And it can be defined by developer.
Throws:
java.lang.Exception
java.io.IOException
See Also:
FileRequest.saveToFile() to learn how to get the file submitted by AceoffixCtrl by writing code of savefile.jsp page.

setBorderStyle

public void setBorderStyle(BorderStyleType value)
Sets the border style of AceoffixCtrl.

Parameters:
value - The default value is BorderStyleType.BorderFlat.

setBorderColor

public void setBorderColor(java.awt.Color value)
Sets the border color of AceoffixCtrl. When BorderStyle is BorderStyleType.BorderNone, this property is invalid.

Parameters:
value - The default value is system button shadow color.

setTheme

public void setTheme(ThemeType value)
Sets the theme of the AceoffixCtrl. When the value of Theme does not equal CustomStyle, the property setting for MenubarColor, MenubarTextColor, TitlebarColor, TitlebarTextColor will be invalid.

Parameters:
value - The default value is ThemeType.Office2010.

setTitlebar

public void setTitlebar(boolean value)
Sets a value that indicates whether the title bar of the AceoffixCtrl shows.

Parameters:
value - The default value is true.

setTitlebarColor

public void setTitlebarColor(java.awt.Color value)
Sets the back color of the title bar of the AceoffixCtrl. When Theme is ThemeType.CustomStyle, this property is valid.

Parameters:
value - The default value is active caption color.

setTitlebarTextColor

public void setTitlebarTextColor(java.awt.Color value)
Sets the text color of the title bar of the AceoffixCtrl. When Theme is ThemeType.CustomStyle, this property is valid.

Parameters:
value - The default value is active caption text color.

setMenubar

public void setMenubar(boolean value)
Sets a value that indicates whether the menu bar of AceoffixCtrl shows. When Theme is ThemeType.CustomStyle, this property is valid.

Parameters:
value - The default value is true.

setMenubarColor

public void setMenubarColor(java.awt.Color value)
Sets the back color of the menu bar of the AceoffixCtrl. When Theme is ThemeType.CustomStyle, this property is valid.

Parameters:
value - The default value is system menu back color.

setMenubarTextColor

public void setMenubarTextColor(java.awt.Color value)
Sets the text color of the menu bar of AceoffixCtrl. When Theme is ThemeType.CustomStyle, this property is valid.

Parameters:
value - The default value is system window text color.

setCustomToolbar

public void setCustomToolbar(boolean value)
Sets a value that indicates whether the custom tool bar of AceoffixCtrl shows.

Parameters:
value - The default value is true.

setOfficeToolbars

public void setOfficeToolbars(boolean value)
Sets a value that indicates whether the tool bars of Microsoft Office shows.

Parameters:
value - The default value is true.

setCaption

public void setCaption(java.lang.String value)
Sets the caption text for AceoffixCtrl.

Parameters:
value - The default value is "Aceoffix".

setAllowCopy

public void setAllowCopy(boolean value)
Sets a value that indicates whether Copy, Paste and Download are allowed in the current document. If the value is false, Copy, Paste and Download will be disabled in the current document.

Parameters:
value - The default value is true.

setFileTitle

public void setFileTitle(java.lang.String value)
The default file name of the Save As dialog box prompted by AceoffixCtrl at the client side. When user try to save the document to local disk at the client side, the Save As dialog appears to allow user to save it under a new file name or location. The FileTitle is the new default file name that appears in the Save As dialog.

Parameters:
value - The default value is the default file name.

setServerPage

public void setServerPage(java.lang.String serverPage)
Sets a value that indicates the URL of Aceoffix server page.

This is an important property of AceoffixCtrl. The Aceoffix server page provides running services for AceoffixCtrl. Before calling openDocument, wordCompare or createNewDocument method, you must set the ServerPage property.

The following example shows how to use ServerPage property.

 aceCtrl1.setServerPage("server.ace"); // Required
 aceCtrl1.openDocument("doc/test.doc", OpenModeType.docNormalEdit, "John Scott");
 aceCtrl1.setTagId("AceoffixCtrl1"); // Required
 

Parameters:
serverPage - The serverPage has no default value. ServerPage is the URL of Aceoffix server page.

The URL can be a relative URL or a complete URL which starts with "http". The relative URL can be relative to the URL of current page and it also can be a root relative URL. The root relative URL starting with "/" is relative to the root path of the web application.

Note: If the URL is a complete URL, make sure that this URL must link to the current website instead of other websites.

See Also:
AceoffixCtrl.setTagId() to learn how to open document online.

setSaveFilePage

public void setSaveFilePage(java.lang.String saveFilePage)
Sets a value that indicates with which page developer would like to receive and save the document sent by AceoffixCtrl.

This is an important property of AceoffixCtrl. If you need to save the document modified by user, you must set a value to SaveFilePage property before you call the OpenDocument or CreateNewDocument method. SaveFilePage is the URL of Web page used to receive and save document.

When AceoffixCtrl is saving document, AceoffixCtrl will first submit data extracted from the document to page specified by SaveDataPage and then submit the document file to page specified by SaveFilePage.

If the SaveDataPage property is not assigned, submitting data action will not execute. If the SaveFilePage property is not assigned, submitting file action will not execute. If both SaveDataPage property and SaveFilePage property are not assigned, AceoffixCtrl will report an error when saving document.

The following example shows how to use SaveFilePage property.

 aceCtrl1.setServerPage("server.ace"); // Required
 aceCtrl1.setSaveFilePage("savefile.jsp"); // Set savefile.jsp to save file.
 aceCtrl1.openDocument("doc/test.doc", OpenModeType.docNormalEdit, "John Scott");
 aceCtrl1.setTagId("AceoffixCtrl1"); // Required
 

Parameters:
saveFilePage - The saveFilePage has no default value. SaveFilePage is the URL of Web page used to receive and save document.

The URL can be a relative URL or a complete URL which starts with "http". The relative URL can be relative to the URL of current page and it also can be a root relative URL. The root relative URL starting with "/" is relative to the root path of the web application.

Note: If the URL is a complete URL, make sure that this URL must link to the current website instead of other websites.

See Also:
AceoffixCtrl.setTagId() to learn how to open document online.

setSaveDataPage

public void setSaveDataPage(java.lang.String saveDataPage)
Sets a value that indicates with which page developers would like to receive and save the data sent by AceoffixCtrl.

This is an important property of AceoffixCtrl. If you need to save data inputted by user in the document, you must set a value to SaveDataPage property before you call the OpenDocument method. SaveDataPage is the URL of Web page used to receive and save data from the document.

If the document is Word document, the OpenMode in OpenDocument must be Aceoffix.OpenModeType.docSubmitForm. If the document is Excel document, the OpenMode in OpenDocument must be Aceoffix.OpenModeType.xlsSubmitForm.

After setting SaveDataPage property, you should create the SaveData page to receive and save the data sent by AceoffixCtrl. In SaveData page, you must create com.acesoft.aceoffix.wordreader.WordDocument or com.acesoft.aceoffix.excelreader.Workbook object to get data from the document.

When AceoffixCtrl is saving document, AceoffixCtrl will first submit data extracted from the document to page specified by SaveDataPage and then submit the document file to page specified by SaveFilePage.

If the SaveDataPage property is not assigned, submitting data action will not execute. If the SaveFilePage property is not assigned, submitting file action will not execute. If both SaveDataPage property and SaveFilePage property are not assigned, AceoffixCtrl will report an error when saving document.

The following example shows how to use SaveDataPage property.

Word code example:

 aceCtrl1.setServerPage("server.ace"); // Required
 WordDocument wd = new WordDocument();
 DataRegion dataRegion = wd.openDataRegion("name");
 dataRegion.setEditing(true);
 aceCtrl1.setSaveDataPage("savedata.jsp");
 aceCtrl1.bind(wd);// The data source is a WordDocument object.
 aceCtrl1.openDocument("doc/test.doc", OpenModeType.docSubmitForm, "Tom");
 aceCtrl1.setTagId("AceoffixCtrl1"); // Required
 

Excel code example:

 aceCtrl1.setServerPage("server.ace"); // Required
 Workbook wb = new Workbook();
 Cell cell1 = wb.openSheet("Order").OpenCell("B5");
 cell1.setReadOnly(false);// Enable edit
 aceCtrl1.setSaveDataPage("savedata.jsp");
 aceCtrl1.bind(wb);// The data source is a Workbook object.
 aceCtrl1.openDocument("doc/test.xls", OpenModeType.xlsSubmitForm, "Tom");
 aceCtrl1.setTagId("AceoffixCtrl1"); // Required
 

Parameters:
saveDataPage - The property has no default value. SaveDataPage is the URL of Web page used to receive and save data from the document.

The URL can be a relative URL or a complete URL which starts with "http". The relative URL can be relative to the URL of current page and it also can be a root relative URL. The root relative URL starting with "/" is relative to the root path of the web application.

Note: If the URL is a complete URL, make sure that this URL must link to the current website instead of other websites.


setSaveFileMaxSize

public void setSaveFileMaxSize(int value)
Sets the max size of saving document by AceoffixCtrl, in bytes. This property is used to limit the oversize document that user submits to the Web server.

Parameters:
value - The default value is 0 which means that there is no limit to the size of saving document.

setCompressDocument

public void setCompressDocument(boolean value)
Sets a value that indicates whether the document will be compressed when AceoffixCtrl saving document.

If the value is true, AceoffixCtrl will compress the document and then save the compressed document to the Web server. When opening the compressed document next time, AceoffixCtrl can automatically identify it and open it. The advantages of using CompressDocument property are saving the space of server disk, reducing network traffic and speeding up opening or saving document. The disadvantage of using CompressDocument property is that the compressed format cannot be easily identified by other softwares and the users logged on the Web server cannot open the compressed documents by double-clicking. Typically, there is no need to use this property.

Parameters:
value - The default value is false.

setHTTPBasic_UserName

public void setHTTPBasic_UserName(java.lang.String value)
The user name used in HTTP Basic Authentication. If your website use HTTP Basic Authentication or Windows integrated authentication, you should set the user name and password to ensure that AceoffixCtrl can succeed to open and save the document.


setHTTPBasic_Password

public void setHTTPBasic_Password(java.lang.String value)
The password used in HTTP Basic Authentication. If your website use HTTP Basic Authentication or Windows integrated authentication, you should set the user name and password to ensure that AceoffixCtrl can succeed to open and save the document.


setTimeSpan

public void setTimeSpan(int value)
Sets the time span of concurrency control, in minutes.

When many people attempt to modify a document online at the same time, a document lock must be implemented so that modifications made by one person do not adversely affect those of another persons. This is called document concurrency in Aceoffix.

If the value of TimeSpan is greater than 0, the concurrency control will be started to control the current document.

The value of TimeSpan means how many minutes a owner can lock the document.

When TimeSpan is timeout, Aceoffix will automatically release the lock and the owner cannot save the document. If the owner closes the document before the TimeSpan is timeout, Aceoffix also will automatically release the lock. After the lock is released, other user can open the document for editing immediately.

During the lock is valid, other users can open the document as read-only.

Parameters:
The - default value is 0 which means that the current document do not use concurrency control.

setJsFunction_AfterDocumentOpened

public void setJsFunction_AfterDocumentOpened(java.lang.String value)
Sets a JavaScript function for AfterDocumentOpened event.

This event is triggered at the client-side after the document is opened. If you want to capture this event, You should define a JavaScript function in the current page.

The following code example shows how to use the JsFunction_AfterDocumentOpened property.

 aceCtrl1.setJsFunction_AfterDocumentOpened("AfterDocumentOpened()");
 

And then, you should define the AfterDocumentOpened() JavaScript function in the current page.

 <script language="javascript" type="text/javascript">
     function AfterDocumentOpened() {
         // Add your code here.
     }
 </script>
 


setJsFunction_AfterDocumentClosed

public void setJsFunction_AfterDocumentClosed(java.lang.String value)
Sets a JavaScript function for AfterDocumentClosed event.

This event is triggered at the client-side after the document is closed. If you want to capture this event, You should define a JavaScript function in the current page.

The following code example shows how to use the JsFunction_AfterDocumentClosed property.

 aceCtrl1.setJsFunction_AfterDocumentClosed("AfterDocumentClosed()");
 

And then, you should define the AfterDocumentClosed() JavaScript function in the current page.

 <script language="javascript" type="text/javascript">
     function AfterDocumentClosed() {
         // Add your code here.
     }
 </script>
 


setJsFunction_AfterDocumentSaved

public void setJsFunction_AfterDocumentSaved(java.lang.String value)
Sets a JavaScript function for AfterDocumentSaved event.

This event is triggered at the client-side after the document is saved. If you want to capture this event, You should define a JavaScript function in the current page.

The following code example shows how to use the JsFunction_AfterDocumentSaved property.

 aceCtrl1.setJsFunction_AfterDocumentSaved("AfterDocumentSaved()");
 

And then, you should define the AfterDocumentSaved() JavaScript function in the current page.

 <script language="javascript" type="text/javascript">
     function AfterDocumentSaved() {
         // Add your code here.
     }
 </script>
 


setJsFunction_BeforeDocumentClosed

public void setJsFunction_BeforeDocumentClosed(java.lang.String value)
Sets a JavaScript function for BeforeDocumentClosed event.

This event is triggered at the client-side before the document is closed. If you want to capture this event, You should define a JavaScript function in the current page.

In the JavaScript function, you can return false to prevent from closing the document.

But returning false cannot prevent web browser from being closed. If you want to check whether current document is modified and notice user to save document before close page, we recommend you write code into onunload event of the page.

The following code example shows how to use the JsFunction_BeforeDocumentClosed property.

 aceCtrl1.setJsFunction_BeforeDocumentClosed("BeforeDocumentClosed()");
 

And then, you should define the BeforeDocumentClosed() JavaScript function in the current page.

 <script language="javascript" type="text/javascript">
     function BeforeDocumentClosed() {
         // Add your code here.
         return true;
     }
 </script>
 


setJsFunction_BeforeDocumentSaved

public void setJsFunction_BeforeDocumentSaved(java.lang.String value)
Sets a JavaScript function for BeforeDocumentSaved event.

This event is triggered at the client-side before the document is saved. If you want to capture this event, You should define a JavaScript function in the current page.

In the JavaScript function, you can return false to prevent from saving the document.

The following code example shows how to use the JsFunction_BeforeDocumentSaved property.

 aceCtrl1.setJsFunction_BeforeDocumentSaved("BeforeDocumentSaved()");
 

And then, you should define the BeforeDocumentSaved() JavaScript function in the current page.<

 <script language="javascript" type="text/javascript">
     function BeforeDocumentSaved() {
         // Add your code here.
         return true;
     }
 </script>
 


setJsFunction_OnWordDataRegionClick

public void setJsFunction_OnWordDataRegionClick(java.lang.String value)
Sets a JavaScript function for OnWordDataRegionClick event.

This event is triggered when user clicks the DataRegion predefined in Word document. If you want to capture this event, you should define a JavaScript function in the current page.

In the JavaScript function, you can return a value to set the value of DataRegion.

The following code example shows how to use the JsFunction_OnWordDataRegionClick property.

 aceCtrl1.setJsFunction_OnWordDataRegionClick("OnWordDataRegionClick()");
 

And then, you should define OnWordDataRegionClick() function in the current page.

 <script language="javascript" type="text/javascript">
     function OnWordDataRegionClick(Name, Value, Left, Bottom) {
         if (Name == "ACE_N004") {
             return "Developer can raise a dialog box at here and get the value inputted by user.";
         }
     }
 </script>
 


setJsFunction_OnExcelCellClick

public void setJsFunction_OnExcelCellClick(java.lang.String value)
Sets a JavaScript function for OnExcelCellClick event.

This event is triggered when user clicks the cell in Excel document. If you want to capture this event, you should define a JavaScript function in the current page.

In the JavaScript function, you can return a value to set the value of the current Cell.

The following code example shows how to use the JsFunction_OnExcelCellClick property.

 aceCtrl1.setJsFunction_OnExcelCellClick("OnExcelCellClick()");
 

And then, you should define the OnExcelCellClick() JavaScript function in the current page.

 <script language="javascript" type="text/javascript">
     function OnExcelCellClick(CellAddress, Value, Left, Bottom) {
         if (CellAddress == "Sheet!$B$5") {
             return "Developer can raise a dialog box at here and get the value inputted by user.";
         }
     }
 </script>
 


setCustomMenuCaption

public void setCustomMenuCaption(java.lang.String value)
Sets the caption of custom menu.

Parameters:
value - The default value is "Custom Me&nu".

setProtectPassword

public void setProtectPassword(java.lang.String value)
Sets protection password for the current Word or Excel document when the document has a protection password.


setVisible

public void setVisible(boolean value)
Sets a value that indicates whether AceoffixCtrl is visible when it is running.


setEnableUserProtection

public void setEnableUserProtection(boolean value)
Indicates whether the document protection set by user will be enabled. It can only be applied to Word and Excel document and can only be used in the docNormalEdit and xlsNormalEdit mode. Typically, there is no need to set this property. Aceoffix can protect the document automatically and control document flow better.

Parameters:
value - The default value is false.

getRibbonBar

public RibbonToolbar getRibbonBar()
                           throws java.lang.Exception
Gets the Ribbon bar object to customize the Ribbon toolbar of Office2007/2010/2013/2016.

Returns:
RibbonToolbar object.
Throws:
java.lang.Exception

setInstallationHint

public void setInstallationHint(java.lang.String value)
Customize installation hint of Acoeffix at client side.


addCustomMenuItem

public void addCustomMenuItem(java.lang.String caption,
                              java.lang.String jsFunction,
                              boolean enabled)
                       throws java.lang.Exception
Adds a menu item to custom menu. Call this method to add each menu item. The click event of new menu-item can be triggered by the specified JavaScript function.

The following code example shows how to use the addCustomMenuItem method.

 aceCtrl1.setCustomMenuCaption("My &Tools");
 aceCtrl1.addCustomMenuItem("&Show revisions", "OnCustomMenuClick()", true);
 aceCtrl1.addCustomMenuItem("&Hide revisions", "OnCustomMenuClick()", true);
 aceCtrl1.addCustomMenuItem("-", "", true);
 aceCtrl1.addCustomMenuItem("&Accept all revisions", "DoAcceptAll()", false);
 

And then, you should define the JavaScript functions in the current page.

 <script language="javascript" type="text/javascript">
     function OnCustomMenuClick(iIndex, sCaption) {
         var AceoffixCtrl1 = document.getElementById("AceoffixCtrl1");
         if (iIndex == 0) AceoffixCtrl1.ShowRevisions = true;
         if (iIndex == 1) AceoffixCtrl1.ShowRevisions = false;
     }
     function DoAcceptAll() {
         document.getElementById("AceoffixCtrl1").AcceptAllRevisions();
     }
 </script> 
 

Parameters:
caption - The caption of new menu item. If the caption is "-", means that this menu item is separator.
jsFunction - The name of JavaScript function. The JavaScript function will be called when user clicks this menu item.
enabled - true: Enable menu item. false: Disable menu item and menu item appears in grey.
Throws:
java.lang.Exception

addCustomToolButton

public void addCustomToolButton(java.lang.String caption,
                                java.lang.String jsFunction,
                                int iconIndex)
                         throws java.lang.Exception
Adds a button to custom tool bar. Call this method to add each button. The click event of new button can be triggered by the specified JavaScript function.

The following code example shows how to use the AddCustomToolButton method.

 aceCtrl1.addCustomToolButton("Save", "SaveDocument()", 1);
 aceCtrl1.addCustomToolButton("Print", "ShowPrintDlg()", 6);
 aceCtrl1.addCustomToolButton("-", "", 0);
 aceCtrl1.addCustomToolButton("Switch Full-screen", "SwitchFullScreen()", 4);
 

And then, you should define the JavaScript functions in the current page.

 <script language="javascript" type="text/javascript">
     function SaveDocument() {
         document.getElementById("AceoffixCtrl1").SaveDocument();
     }
     function ShowPrintDlg() {
         document.getElementById("AceoffixCtrl1").ShowDialog(4); //Print dialog box
     }
     function SwitchFullScreen() {
         document.getElementById("AceoffixCtrl1").FullScreen = !document.getElementById("AceoffixCtrl1").FullScreen;
     }
 </script> 
 

Parameters:
caption - The caption of new button item. If the caption is "-", means that this button item is separator.
jsFunction - JavaScript The name of JavaScript function. The JavaScript function will be called when user clicks this button.
iconIndex - The index of button icon. Aceoffix predefines some button icons and you can use one of them. The default value is 0. Possible values as following:

Custom Toolbutton Icons

Throws:
java.lang.Exception

bind

public void bind(java.lang.Object writerObj)
          throws java.lang.Exception,
                 java.io.IOException
Binds the data source object to the AceoffixCtrl.

When output data to Word document or Excel workbook, you must create a com.acesoft.aceoffix.wordwriter.WordDocument object or a com.acesoft.aceoffix.excelwriter.Workbook object, and call Bind method to set data source object to AceoffixCtrl. If you need to call Bind method, you must call it before calling openDocument or createNewDocument method.

The type of writerObj parameter should be the same as the type of document opened through OpenDocument method. For example, if writerObj is a WordDocument object, the parameter of writerObj must be com.acesoft.aceoffix.wordwriter.WordDocument object.

The following code example shows how to use the Bind method.

Word code example:

 WordDocument wd = new WordDocument();
 DataRegion dataRegion = wd.openDataRegion("name");
 dataRegion.setValue("John");
 aceCtrl1.bind(wd); //The data source is the com.acesoft.aceoffix.wordwriter.WordDocument object.
 

Excel code example:

 Workbook wb = new Workbook();
 Sheet sheetOrder = wb.openSheet("Order");
 sheetOrder.OpenCell("B5").setValue("John");
 aceCtrl1.bind(wb); //The data source is the com.acesoft.aceoffix.excelwriter.Workbook object.
 

Parameters:
writerObj - Data source object. Available object types are com.acesoft.aceoffix.wordwriter.WordDocument and com.acesoft.aceoffix.excelwriter.Workbook.
Throws:
java.lang.Exception
java.io.IOException

openDocument

public void openDocument(java.lang.String documentURL,
                         OpenModeType openMode,
                         java.lang.String userName)
                  throws java.lang.Exception,
                         java.io.IOException
Opens an Office document online.

This is the important method of AceoffixCtrl. It is used to open an Office document online.

The openDocument method should be called at the end of code called by AceoffixCtrl.

Code example: Open the test.doc document and set the document in editable state.

 aceCtrl1.setServerPage("server.ace"); //Required
 //Open the document with URL.
 aceCtrl1.openDocument("doc/test.doc", OpenModeType.docNormalEdit, "John");
 //Open the document from disk path on server.
 aceCtrl1.openDocument("D:\\documents\\test.doc", OpenModeType.docNormalEdit, "John");
 

Parameters:
documentURL - The URL of the document which is going to be opened.

The document can be a file from Web folder and also can be a binary stream outputted by server page. However, the document must be Office document format.

Aceoffix supports many document formats, such as *.doc,*.docx,*.xls,*.xlsx,*.ppt,*.pptx,*.vsd and *.mpp.

The URL can be a relative URL or a complete URL which starts with "http". The relative URL can be relative to the URL of current page and it also can be a root relative URL. The root relative URL starting with "/" is relative to the root path of the application. New feature: The URL can be the physical disk path of the document file on the server. For example: D:\\docfiles\\test.doc.

Note: If the URL is a complete URL, make sure that this URL must link to the current website instead of other websites.

openMode - The open mode AceoffixCtrl should use after the document is opened. Make sure that the openMode is consistent with the file type of the document.
userName - The operator of the current document. Typically, userName should be the name of current user who has logged in your web application.
Throws:
java.lang.Exception
java.io.IOException

createNewDocument

public void createNewDocument(java.lang.String userName,
                              DocumentVersion docVersion)
                       throws java.lang.Exception,
                              java.io.IOException
Creates a new document and open it for editing online.

If you want to create a new document and open it for editing online, you need to use createNewDocument method. The createNewDocument method should be called at the end of code called by AceoffixCtrl.

Creating new document on Web server is very different from creating new document on local computer. Creating new document on Web server must consider the compatibility with all the Microsoft Office softwares installed on client computers. In order to keep the compatibility of Office software version, you should choose the lower DocumentVersion when you create a new document by createNewDocument method.

The following code example shows how to use the createNewDocument method to create a blank document in Word2003 format.

Word code example:

 aceCtrl1.setServerPage("server.ace"); //Required
 aceCtrl1.setSaveFilePage("savefile.jsp?id=1&op=new");
 aceCtrl1.webCreateNew("John", DocumentVersion.Word2003);
 

Parameters:
userName - The operator of the current document. Typically, userName should be the name of current user who has logged in your web application.
docVersion - The document type and version.
Throws:
java.lang.Exception
java.io.IOException

wordCompare

public void wordCompare(java.lang.String documentURL,
                        java.lang.String documentURL2,
                        OpenModeType openMode,
                        java.lang.String userName)
                 throws java.lang.Exception,
                        java.io.IOException
Compares two different Word documents online.

Parameters:
documentURL - The first Word document. Please refer to the openDocument method topic to learn how to use URL.
documentURL2 - The second Word document. Please refer to the openDocument method topic to learn how to use URL.
openMode - The open mode of the document. Only docFinalizeDraft and docReadOnly are valid here. When comparative result is displayed in docFinalizeDraft mode, users can edit the comparative result. When comparative result is displayed in docReadOnly mode, user can only view the comparative results.
userName - The operator of the current document. Typically, userName should be the name of the current user who has logged in your web application.
Throws:
java.lang.Exception
java.io.IOException