|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.acesoft.aceoffix.wordreader.WordDocument
public class WordDocument
Representing a Word document, WordDocument class is used to read the data from the Word document submitted by AceoffixCtrl.
WordDocument is an important class. WordDocument object contains the data submitted by AceoffixCtrl. Typically, WordDocument class is used to read the data that users input into the Word document.
The com.acesoft.aceoffix.wordreader.WordDocument object can only be created in the page specified by AceoffixCtrl.SaveDataPage.
Constructor Summary | |
---|---|
WordDocument(HttpServletRequest request,
HttpServletResponse response)
Initializes a new instance of WordDocument class. |
Method Summary | |
---|---|
void |
close()
Closes the WordDocument and returns a success message for saving. |
java.util.ArrayList<DataRegion> |
getDataRegions()
Gets the DataRegion collection in the current Word document. |
java.lang.String |
getFormField(java.lang.String name)
Gets the value of the Form field specified in the page with AceoffixCtrl. |
DataRegion |
openDataRegion(java.lang.String dataRegionName)
Opens the specified DataRegion and returns the DataRegion object. |
void |
setCustomSaveResult(java.lang.String value)
Sets the custom saving result defined by developer. |
void |
showPage(int width,
int height)
Pops up a custom dialog box in browser to show the saving result in HTML format. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public WordDocument(HttpServletRequest request, HttpServletResponse response) throws java.lang.Exception, java.io.IOException
The com.acesoft.aceoffix.wordreader.WordDocument object can only be created in the page specified by AceoffixCtrl.SaveDataPage.
java.lang.Exception
java.io.IOException
Method Detail |
---|
public void setCustomSaveResult(java.lang.String value)
The following example shows how to use the CustomSaveResult property.
WordDocument wd = new WordDocument(request, response); String strCompanyName = wd.openDataRegion("CompanyName").getValue(); String strProductName = wd.openDataRegion("ProductName").getValue(); //Save the data to the database. wd.setCustomSaveResult("My custom result"); wd.close();
Then, custom saving result can be got from the CustomSaveResult property of AceoffixCtrl with JavaScript.
<script language="javascript" type="text/javascript"> function SaveDocument() { document.getElementById("AceoffixCtrl1").SaveDocument(); alert(document.getElementById("AceoffixCtrl1").CustomSaveResult);//You can determine the next code logic according to the value of CustomSaveResult. } </script>
public java.util.ArrayList<DataRegion> getDataRegions() throws java.io.IOException, java.lang.Exception
java.io.IOException
java.lang.Exception
public DataRegion openDataRegion(java.lang.String dataRegionName) throws java.io.IOException, java.lang.Exception
If the specified DataRegion exists, this method will return the DataRegion object.
The following code example shows how to call the OpenDataRegion method topic to get the value of the specified DataRegion.
WordDocument wd = new WordDocument(request, response); String strCompanyName = wd.openDataRegion("CompanyName").getValue(); String strProductName = wd.openDataRegion("ProductName").getValue(); //Save the data to your database. wd.close(); //Required
dataRegionName
- The name of DataRegion.
java.io.IOException
java.lang.Exception
public void close() throws java.io.IOException
If the code for saving data executes successfully, you should call this method to close the WordDocument object.
java.io.IOException
WordDocument.openDataRegion() to learn how to close the WordDocument object.
public void showPage(int width, int height) throws java.io.IOException
If you want to pop up a custom dialog box to show the saving result in HTML format, you should call this method. The message page shown in dialog box is the current SaveDataPage. By default, the SaveDataPage will display nothing. You can add friendly prompts in SaveDataPage.
The following example shows how to use the ShowPage method to display a custom saving error to user.
WordDocument wd = new WordDocument(request, response); String strCompanyName = wd.openDataRegion("CompanyName").getValue(); if(!strCompanyName.equals("")){ //Save the data to database. } else{ out.println("Failed to save. Company name cannot be empty."); // This is a simple error message, you can add friendly message to the current page. wd.showPage(380, 200); // If the company name is empty, AceoffixCtrl will pop up a dialog box to show the custom error page. } wd.close();
width
- The width of dialog box, in pixels.height
- The height of dialog box, in pixels.
java.io.IOException
public java.lang.String getFormField(java.lang.String name) throws java.io.IOException, java.lang.Exception
When AceoffixCtrl is saving document, you can call this method to get the values of the Form fields specified in the page with AceoffixCtrl.
Note: To capture the value of the Form field, the Form field must contain a name attribute.
The Form field can be Input Box, Drop-down Box, Radio, Check Box, TextArea, Hidden Field etc..
Following example shows how to use GetFormField method to get the value of the Form field posted from the page with AceoffixCtrl.
WordDocument wd = new WordDocument(request, response); String strSubject = wd.getFormField("EditSubject"); //Save the obtained data to database String strCompanyName = wd.openDataRegion("CompanyName").getValue(); wd.close();
name
- The name of the Form field.
java.io.IOException
java.lang.Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |