|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.acesoft.aceoffix.wordreader.WordDocumentPHP
public class WordDocumentPHP
Representing a Word document, WordDocumentPHP class is used to read the data from the Word document submitted by AceoffixCtrl with PHP code.
WordDocumentPHP is an important class. WordDocumentPHP object contains the data submitted by AceoffixCtrl with PHP code. Typically, WordDocumentPHP class is used to read the data that users input into the Word document.
The com.acesoft.aceoffix.wordreader.WordDocumentPHP object can only be created in the page specified by AceoffixCtrl.SaveDataPage.
Constructor Summary | |
---|---|
WordDocumentPHP()
Initializes a new instance of WordDocumentPHP class. |
Method Summary | |
---|---|
java.lang.String |
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. |
void |
load(java.lang.String Input)
Load the request stream with PHP code. |
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 WordDocumentPHP()
The com.acesoft.aceoffix.wordreader.WordDocumentPHP object can only be created in the page specified by AceoffixCtrl.SaveDataPage.
Method Detail |
---|
public void load(java.lang.String Input) throws java.lang.Exception, java.io.IOException
java.lang.Exception
java.io.IOException
public void setCustomSaveResult(java.lang.String value)
The following example shows how to use the CustomSaveResult property.
$ip = GetHostByName($_SERVER['SERVER_NAME']); require_once("http://".$ip.":8080/JavaBridge/java/Java.inc"); $wd = new Java("com.acesoft.aceoffix.wordreader.WordDocumentPHP"); $wd->load(file_get_contents("php://input")); $strCompanyName = wd->openDataRegion("CompanyName")->getValue(); $strProductName = wd->openDataRegion("ProductName")->getValue(); //Save the data to database. $wd->setCustomSaveResult("My custom result"); echo $wd->close(); //Required
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.
$ip = GetHostByName($_SERVER['SERVER_NAME']); require_once("http://".$ip.":8080/JavaBridge/java/Java.inc"); $wd = new Java("com.acesoft.aceoffix.wordreader.WordDocumentPHP"); $wd->load(file_get_contents("php://input")); $strCompanyName = wd->openDataRegion("CompanyName")->getValue(); $strProductName = wd->openDataRegion("ProductName")->getValue(); //Save the data to database. echo $wd->close(); //Required
dataRegionName
- The name of DataRegion.
java.io.IOException
java.lang.Exception
public java.lang.String 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
WordDocumentPHP.openDataRegion() to learn how to close the WordDocumentPHP 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.
$ip = GetHostByName($_SERVER['SERVER_NAME']); require_once("http://".$ip.":8080/JavaBridge/java/Java.inc"); $wd = new Java("com.acesoft.aceoffix.wordreader.WordDocumentPHP"); $wd->load(file_get_contents("php://input")); $name = $wd->openDataRegion("CompanyName")->getValue(); if(strcasecmp("", $name) != 0){ //Save the data to database. } else{ echo "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. } echo $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.
$ip = GetHostByName($_SERVER['SERVER_NAME']); require_once("http://".$ip.":8080/JavaBridge/java/Java.inc"); $wd = new Java("com.acesoft.aceoffix.wordreader.WordDocumentPHP"); $wd->load(file_get_contents("php://input")); $strSubject = $wd.getFormField("EditSubject"); // After you get the input text, you can save it to the database. echo $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 |