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:
3.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)
          Add a menu item to custom menu.
 void addCustomToolButton(java.lang.String caption, java.lang.String jsFunction, int iconIndex)
          Add a button to custom toolbar.
 void bind(java.lang.Object SourceObj)
          Bind the data source object to the AceoffixCtrl.
 void createNewDocument(java.lang.String userName, DocumentVersion docVersion)
          Create a new document and open it for editing online.
 void openDocument(java.lang.String documentURL, OpenModeType openMode, java.lang.String userName)
          Open an Office document online.
 void setAllowCopy(boolean allowCopy)
          Sets a value that indicates whether allow Copy and Paste in the current document.
 void setBorderColor(java.awt.Color borderColor)
          Sets the border color of the AceoffixCtrl.
 void setBorderStyle(BorderStyleType borderStyle)
          Sets the border style of the AceoffixCtrl.
 void setCaption(java.lang.String caption)
          Sets the caption text for the AceoffixCtrl.
 void setCompressDocument(boolean compressDocument)
          Sets a value that indicates whether the document will be compressed when AceoffixCtrl saving document.
 void setCustomMenuCaption(java.lang.String customMenuCaption)
          Sets the caption of custom menu.
 void setCustomToolbar(boolean customToolbar)
          Sets a value that indicates whether show custom tool bar of the AceoffixCtrl.
 void setEncryptDocument(boolean encryptDocument)
          Sets a value that indicates whether the document will be encrypted when AceoffixCtrl saving document.
 void setFileTitle(java.lang.String fileTitle)
          The default file name of the Save As dialog box prompted by AceoffixCtrl.
 void setHTTPBasic_Password(java.lang.String hTTPBasic_Password)
          The password name used in HTTP Basic Authentication.
 void setHTTPBasic_UserName(java.lang.String hTTPBasic_UserName)
          The user name used in HTTP Basic Authentication.
 void setJsFunction_AfterDocumentClosed(java.lang.String jsFunction_AfterDocumentClosed)
          Sets a JavaScript function for AfterDocumentClosed event.
 void setJsFunction_AfterDocumentOpened(java.lang.String jsFunction_AfterDocumentOpened)
          Sets a JavaScript function for AfterDocumentOpened event.
 void setJsFunction_AfterDocumentSaved(java.lang.String jsFunction_AfterDocumentSaved)
          Sets a JavaScript function for AfterDocumentSaved event.
 void setJsFunction_BeforeDocumentClosed(java.lang.String jsFunction_BeforeDocumentClosed)
          Sets a JavaScript function for BeforeDocumentClosed event.
 void setJsFunction_BeforeDocumentSaved(java.lang.String jsFunction_BeforeDocumentSaved)
          Sets a JavaScript function for BeforeDocumentSaved event.
 void setMenubar(boolean menubar)
          Sets a value that indicates whether show menubar of the AceoffixCtrl.
 void setMenubarColor(java.awt.Color menubarColor)
          Sets the back color of the menubar of the AceoffixCtrl.
 void setMenubarTextColor(java.awt.Color menubarTextColor)
          Sets the back color of the menubar of the AceoffixCtrl.
 void setOfficeToolbars(boolean officeToolbars)
          Sets a value that indicates whether show toolbars of Microsoft Office.
 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 saveFileMaxSize)
          Sets the max size of saving document, in bytes.
 void setSaveFilePage(java.lang.String saveFilePage)
          Sets a value that indicates with which page developers 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 theme)
          Sets the theme of the AceoffixCtrl.
 void setTimeSpan(int timeSpan)
          Sets the time span of concurrency control, in minutes.
 void setTitlebar(boolean titlebar)
          Sets a value that indicates whether show title bar of the AceoffixCtrl.
 void setTitlebarColor(java.awt.Color titlebarColor)
          Sets the back color of the titlebar of the AceoffixCtrl.
 void setTitlebarTextColor(java.awt.Color titlebarTextColor)
          Sets the text color of the titlebar of the AceoffixCtrl.
 
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 must call it at the end of AceoffixCtrl calling code.

Parameters:
id - The id is the id of AceoffixCtrl tag.
Throws:
java.lang.Exception
java.io.IOException

setBorderStyle

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

Parameters:
borderStyle - The default is BorderStyleType.BorderFlat.

setBorderColor

public void setBorderColor(java.awt.Color borderColor)
Sets the border color of the AceoffixCtrl. When BorderStyle is BorderStyleType.BorderFlat, this property is valid.

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

setTheme

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

Parameters:
theme - The default value is ThemeType.Office2007.

setTitlebar

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

Parameters:
titlebar - The default value is true.

setTitlebarColor

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

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

setTitlebarTextColor

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

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

setMenubar

public void setMenubar(boolean menubar)
Sets a value that indicates whether show menubar of the AceoffixCtrl.

Parameters:
menubar - The default value is true.

setMenubarColor

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

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

setMenubarTextColor

public void setMenubarTextColor(java.awt.Color menubarTextColor)
Sets the back color of the menubar of the AceoffixCtrl. When Theme is ThemeType.CustomStyle, this property is valid.

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

setCustomToolbar

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

Parameters:
customToolbar - The default value is true.

setOfficeToolbars

public void setOfficeToolbars(boolean officeToolbars)
Sets a value that indicates whether show toolbars of Microsoft Office.

Parameters:
officeToolbars - The default value is true.

setCaption

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

Parameters:
caption - The default value is "Aceoffix is a web development platform for Microsoft Office.".

setAllowCopy

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

Parameters:
allowCopy - The default value is true.

setFileTitle

public void setFileTitle(java.lang.String fileTitle)
The default file name of the Save As dialog box prompted by AceoffixCtrl. If users try to save the document to their local disk, the Save As dialog appears to allow users to save it under a new file name or location. The FileTitle is the new file name by default appears in the Save As dialog.

Parameters:
fileTitle - The default value is "".

setServerPage

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

This is the important property of AceoffixCtrl. The Aceoffix server page provides service for the AceoffixCtrl. You must set the ServerPage property before you call the openDocument or createNewDocument method.

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

 aceCtrl1.setServerPage("../aceserver.do"); //Required
 aceCtrl1.openDocument("doc/test.doc", OpenModeType.docNormalEdit, "Jack");
 aceCtrl1.setTagId("AceoffixCtrl1"); //Required
 

Parameters:
serverPage - The property has no default value. ServerPage is the URL of Aceoffix server page. The Aceoffix server page is a very important page provided by Aceoffix.

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.

Note: If the URL is a complete URL, make sure that this URL must link to the current website instead of other websites. It is recommended that you use a relative URL to make the application more portable.


setSaveFilePage

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

This is the important property of AceoffixCtrl. If you need to save the document modified by users, 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.

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

 aceCtrl1.setServerPage("../aceserver.do"); //Required
 aceCtrl1.setSaveFilePage("savefile.jsp"); // Set savefile.jsp to receive and save document.
 aceCtrl1.openDocument("doc/test.doc", OpenModeType.docNormalEdit, "Jack");
 aceCtrl1.setTagId("AceoffixCtrl1"); //Required
 

Parameters:
saveFilePage - The property 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 application.

Note: If the URL is a complete URL, make sure that this URL must link to the current website instead of other websites. It is recommended that you use a relative URL to make the application more portable.


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 the important property of AceoffixCtrl. If you need to save data inputted by users 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.

Before calling openDocument method, you should create WordResponse or ExcelResponse object to specify the DataRegions or Cells, TableRanges which will be submitted and call the bind method.

If the document is Word document, the OpenMode in openDocument must be OpenModeType.docSubmitForm. If the document is Excel document, the OpenMode in openDocument must be 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 WordRequest or ExcelRequest 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 code example shows how to use the SaveDataPage property.

Word code example:

 aceCtrl1.setServerPage("../aceserver.do"); //Required
 WordResponse wr = new WordResponse();
 WordResDataRegion dataRegion = wr.openDataRegion("name");
 dataRegion.setNeedSubmit(true);
 aceCtrl1.setSaveDataPage("savedata.jsp");
 aceCtrl1.bind(wr);
 aceCtrl1.openDocument("doc/test.doc", OpenModeType.docSubmitForm, "Jack");
 aceCtrl1.setTagId("AceoffixCtrl1"); //Required
 

Excel code example:

 aceCtrl1.setServerPage("../aceserver.do"); //Required
 ExcelResponse er = new ExcelResponse();
 ExcelResCell cell1 = eres.openSheet("Sheet1").OpenCell("B2");
 cell1.setSubmitName("ItemCount");
 aceCtrl1.setSaveDataPage("savedata.jsp");
 aceCtrl1.bind(er);
 aceCtrl1.openDocument("doc/test.xls", OpenModeType.xlsSubmitForm, "Jack");
 aceCtrl1.setTagId("AceoffixCtrl1"); //Required
 

Parameters:
saveFilePage - 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 application.

Note: If the URL is a complete URL, make sure that this URL must link to the current website instead of other websites. It is recommended that you use a relative URL to make the application more portable.


setSaveFileMaxSize

public void setSaveFileMaxSize(int saveFileMaxSize)
Sets the max size of saving document, in bytes. This property is used to limit the big document to save to the Web server.

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

setEncryptDocument

public void setEncryptDocument(boolean encryptDocument)
Sets a value that indicates whether the document will be encrypted when AceoffixCtrl saving document.

If the value is true, AceoffixCtrl will encrypt the document and then save it to the Web server. When AceoffixCtrl open the encrypted document next time, AceoffixCtrl can automatically identify it and open it. Using EncryptDocument property will enhance the security of the documents on the Web server. The encrypted format can not be easily identified by other softwares and users logged on the Web server can not double-click to open the encrypted document. But typically, there is no need to use this property.

Parameters:
encryptDocument - The default value is false.

setCompressDocument

public void setCompressDocument(boolean compressDocument)
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 it to the Web server. When AceoffixCtrl open the compressed document next time, AceoffixCtrl can automatically identify it and open it. The advantage of using CompressDocument property is reducing the server disk space requirements and reducing the network traffic and speeding up the rate of opening and saving document. The disadvantage of using CompressDocument property is that the compressed format can not be easily identified by other softwares and users logged on the Web server can not double-click to open the compressed document. Typically, there is no need to use this property.

Parameters:
compressDocument - The default value is false.

setHTTPBasic_UserName

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


setHTTPBasic_Password

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


setTimeSpan

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

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

A system of locks prevents users from modifying document in a way that affects other users. After a user opens a document for editing that causes a lock to be applied, other users cannot open this document for editing that would conflict with the lock until the owner releases it. 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 can not 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:
timeSpan - 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 jsFunction_AfterDocumentOpened)
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 HTML code of current page.


setJsFunction_AfterDocumentClosed

public void setJsFunction_AfterDocumentClosed(java.lang.String jsFunction_AfterDocumentClosed)
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 HTML code of current page.


setJsFunction_AfterDocumentSaved

public void setJsFunction_AfterDocumentSaved(java.lang.String jsFunction_AfterDocumentSaved)
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 HTML code of current page.


setJsFunction_BeforeDocumentClosed

public void setJsFunction_BeforeDocumentClosed(java.lang.String jsFunction_BeforeDocumentClosed)
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 HTML code of current page.


setJsFunction_BeforeDocumentSaved

public void setJsFunction_BeforeDocumentSaved(java.lang.String jsFunction_BeforeDocumentSaved)
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 HTML code of current page.


setCustomMenuCaption

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

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

addCustomMenuItem

public void addCustomMenuItem(java.lang.String caption,
                              java.lang.String jsFunction,
                              boolean enabled)
Add 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 HTML code of 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 click this menu item.
enabled - true: Enable menu item. false: Disable menu item and appear in grey.

addCustomToolButton

public void addCustomToolButton(java.lang.String caption,
                                java.lang.String jsFunction,
                                int iconIndex)
Add a button to custom toolbar. 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 HTML code of 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 - The name of JavaScript function. The JavaScript function will be called when user click 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


bind

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

When accessing data from Word document or Excel workbook, you must create a data source object and call bind method. If you need to call bind method, you must call it before calling openDocument method.

The type of SourceObj parameter should be the same as the type of document opened through openDocument method. For example, if SourceObj is a WordResponse object, the openDocument method should open a Word document.

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

Word code example:

 WordResponse wr = new WordResponse();
 WordResDataRegion dataRegion = wr.openDataRegion("name");
 dataRegion.setValue("John Scott");
 aceCtrl1.bind(wr); //The data source is a WordResponse object.
 

Excel code example:

 ExcelResponse er = new ExcelResponse();
 ExcelResSheet sheetOrder = er.OpenSheet("Order");
 sheetOrder.OpenCell("B5").Value = "John Scott";
 aceCtrl1.bind(er);
 

Parameters:
SourceObj - Data source object. Available object types are WordResponse and ExcelResponse.
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
Open an Office document online.

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

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 open the document and set the document in editable state.

 aceCtrl1.setServerPage("../aceserver.do"); //Required
 aceCtrl1.openDocument("doc/test.doc", OpenModeType.docNormalEdit, "John Scott");
 

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,*.xml and *.rtf.

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. Note: If the URL is a complete URL, make sure that this URL must link to the current website instead of other websites. It is recommended that you use a relative URL to make the application more portable.

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

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 an empty document in Word2003 format.

Word code example:

 aceCtrl1.setServerPage("../aceserver.do"); //Required
 aceCtrl1.setSaveFilePage("savefile.jsp?id=1&op=new");
 aceCtrl1.createNewDocument("John Scott", 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