|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.acesoft.aceoffix.excelreader.WorkbookPHP
public class WorkbookPHP
Representing an Excel document, WorkbookPHP class is used to read the data submitted by AceoffixCtrl with PHP code.
WorkbookPHP is an important class. WorkbookPHP object contains the data submitted by AceoffixCtrl. If you need to extract data from Excel spreadsheet with PHP code, you have to create WorkbookPHP object. com.acesoft.aceoffix.excelreader.WorkbookPHP object can only be created in the page specified in the AceoffixCtrl.SaveDataPage.
Constructor Summary | |
---|---|
WorkbookPHP()
Initializes a new instance of WorkbookPHP class. |
Method Summary | |
---|---|
java.lang.String |
close()
Closes the Workbook object and returns a success message for saving. |
java.lang.String |
getFormField(java.lang.String name)
Gets the value of the Form field specified in the page with AceoffixCtrl. |
java.util.ArrayList<Sheet> |
getSheets()
Gets the Sheet collection submitted by AceoffixCtrl. |
void |
load(java.lang.String Input)
Load the request stream with PHP code. |
Sheet |
openSheet(java.lang.String sheetName)
Opens the specified worksheet and returns a Sheet 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 WorkbookPHP()
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"); $wb = new Java("com.acesoft.aceoffix.excelreader.WorkbookPHP"); $wb->load(file_get_contents("php://input")); $sheet1 = $wb->openSheet("Sheet1"); $strCompanyName = $sheet1->openCell("CompanyName")->getValue(); //Save the data to database. $wb->setCustomSaveResult("My custom result"); echo $wb->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<Sheet> getSheets() throws java.io.IOException, java.lang.Exception
java.io.IOException
java.lang.Exception
public Sheet openSheet(java.lang.String sheetName) throws java.io.IOException, java.lang.Exception
sheetName
- The name of the Sheet. The Sheet name can be found on the Tab tag at the bottom of the worksheet.
java.io.IOException
java.lang.Exception
WorkbookPHP.setCustomSaveResult().
public java.lang.String close() throws java.io.IOException
If the code for saving document executes successfully, you must call this method to close the Workbook object.
java.io.IOException
WorkbookPHP.setCustomSaveResult().
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.
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..
The 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"); $wb = new Java("com.acesoft.aceoffix.excelreader.WorkbookPHP"); $wb->load(file_get_contents("php://input")); $strSubject = $wb.getFormField("EditSubject"); // After you get the input text, you can save it to the database. echo $wb->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 |