|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.acesoft.aceoffix.excelreader.Workbook
public class Workbook
Representing an Excel document, Workbook class is used to read the data submitted by AceoffixCtrl.
Workbook is an important class. Workbook object contains the data submitted by AceoffixCtrl. If you need to extract data from Excel spreadsheet, you have to create Workbook object. com.acesoft.aceoffix.excelreader.Workbook object can only be created in the page specified in the AceoffixCtrl.SaveDataPage.
Constructor Summary | |
---|---|
Workbook(HttpServletRequest request,
HttpServletResponse response)
Initializes a new instance of Workbook class. |
Method Summary | |
---|---|
void |
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. |
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 Workbook(HttpServletRequest request, HttpServletResponse response) throws java.lang.Exception, java.io.IOException
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.
Workbook wb = new Workbook(request, response); Sheet sheet1 = wb.openSheet("sheet1"); String strCompanyName = sheet1.openCell("CompanyName").getValue(); //Save the data to database. wb.setCustomSaveResult("My custom result"); 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
Sheet.openCell().
public void 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
Sheet.openTable().
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
Sheet.openTable() to learn how to use the ShowPage method to display a custom saving error to user.
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.
Workbook wb = new Workbook(request, response); String strSubject = wb.getFormField("EditSubject"); //Save the obtained data to database. Sheet sheet1 = wb.openSheet("sheet1"); String strCompanyName = sheet1.openCell("CompanyName").getValue(); 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 |