com.acesoft.aceoffix
Class ExcelResTableRange

java.lang.Object
  extended by com.acesoft.aceoffix.ExcelResTableRange

public class ExcelResTableRange
extends java.lang.Object

Represents a TableRange. Fills data into TableRange and controls behavior of TableRange.

In Excel worksheet, developer can define any range of cells containing one contiguous block of cells as a TableRange object. You should use TableRange object if you want to operate a range of cells or access a data set.

You can use ExcelResTableRange object not only to fill data into a specified range of cells, but also to draw a new table on an empty range. You can only use the ExcelResSheet.openTableRange method to obtain a ExcelResTableRange object.

Version:
3.0
Author:
Acesoft Corporation

Method Summary
 void close()
          Closes the current TableRange.
 ExcelResBorder getBorder()
          Gets the border object of the TableRange.
 DataFieldResCollection getDataFields()
          Returns a collection of DataField objects of the current record.
 java.lang.String getRangeAddress()
          Gets the range address of the TableRange.
 void merge()
          Creates a merged cell from the TableRange.
 void merge(boolean across)
          Creates a merged cell from the TableRange.
 void nextRow()
          Closes the current record row and Moves to the next record row in the TableRange.
 void setBackColor(java.awt.Color value)
          Sets the back color of the TableRange.
 void setColumnWidth(double value)
          Sets the width of all the columns in the TableRange.
 void setForeColor(java.awt.Color value)
          Sets the fore color of the TableRange.
 void setReadOnly(boolean value)
          Sets a value that indicates whether the TableRange is read-only.
 void setRowHeight(double value)
          Sets the height of all the rows in the TableRange, measured in points.
 void setSubmitName(java.lang.String value)
          Sets the SubmitName of the TableRange.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getRangeAddress

public java.lang.String getRangeAddress()
                                 throws java.io.IOException
Gets the range address of the TableRange. It is the specified RangeAddress when you open the TableRange. It use A1-style notation.

Throws:
java.io.IOException

getDataFields

public DataFieldResCollection getDataFields()
                                     throws java.lang.Exception
Returns a collection of DataField objects of the current record.

Throws:
java.lang.Exception

getBorder

public ExcelResBorder getBorder()
                         throws java.io.IOException
Gets the border object of the TableRange.

Throws:
java.io.IOException

setBackColor

public void setBackColor(java.awt.Color value)
                  throws java.io.IOException
Sets the back color of the TableRange.

Throws:
java.io.IOException

setForeColor

public void setForeColor(java.awt.Color value)
                  throws java.io.IOException
Sets the fore color of the TableRange.

Throws:
java.io.IOException

setRowHeight

public void setRowHeight(double value)
                  throws java.io.IOException
Sets the height of all the rows in the TableRange, measured in points.

Throws:
java.io.IOException

setColumnWidth

public void setColumnWidth(double value)
                    throws java.io.IOException
Sets the width of all the columns in the TableRange.

Throws:
java.io.IOException

setReadOnly

public void setReadOnly(boolean value)
                 throws java.io.IOException
Sets a value that indicates whether the TableRange is read-only.

If the value is true, the editable TableRange will be read-only. And if the value is false, the read-only TableRange will be editable. Only when OpenMode is OpenModeType.xlsSubmitForm, the ReadOnly property is valid.

Throws:
java.io.IOException

setSubmitName

public void setSubmitName(java.lang.String value)
                   throws java.lang.Exception,
                          java.io.IOException
Sets the SubmitName of the TableRange. The SubmitName is used to mark the TableRange to be submitted.

If you do not want to get values of the TableRange when saving document, you can ignore the SubmitName property. If you assign the SubmitName property, it means that the values of the TableRange should be submitted. When saving document, you must use the SubmitName as the parameter of ExcelReqSheet.openTableRange method to get the values of this TableRange. When SubmitName is defined and OpenMode is OpenModeType.xlsSubmitForm, the TableRange will automatically be editable. If you want the TableRange to be read-only, you should assign true to the ReadOnly property of this TableRange object.

The following code example shows how to mark a table to be submitted.

 ExcelResponse er = new ExcelResponse();
 ExcelResSheet sheet1 = er.openSheet("sheet1");

 sheet1.openCell("C2").setSubmitName("CompanyName"); // This cell will be submitted.
 sheet1.openTableRange("B6:F10").setSubmitName("SalesInfo");// This table will be submitted.
 
 aceCtrl1.setServerPage("../aceserver.do"); //Required
 aceCtrl1.setSaveDataPage("savedata.jsp");
 aceCtrl1.bind(er);
 aceCtrl1.openDocument("doc/test.xls", OpenModeType.xlsSubmitForm, "Jack");
 aceCtrl1.setTagId("AceoffixCtrl1"); //Required
 

Parameters:
value - The SubmitName is a name for submitting and is defined by developer. It will be used as the parameter of the ExcelReqSheet.openTableRange method.

Typically, you can use a data table name as the SubmitName. The SubmitName must be unique in one worksheet. The default value is an empty string which means this TableRange will not be submitted.

The SubmitName is case-sensitive.

Throws:
java.lang.Exception
java.io.IOException

nextRow

public void nextRow()
             throws java.lang.Exception,
                    java.io.IOException
Closes the current record row and Moves to the next record row in the TableRange. As long as the assignment of the current row is finished, you should call the nextRow method to close the current row even if you do not need to assign a new row any more.

Throws:
java.lang.Exception
java.io.IOException

close

public void close()
           throws java.lang.Exception,
                  java.io.IOException
Closes the current TableRange. When all the operations of current TableRange are done, you must call the Close method to close the TableRange. Once the TableRange is closed, you can not reference it again.

Throws:
java.lang.Exception
java.io.IOException

merge

public void merge()
           throws java.lang.Exception,
                  java.io.IOException
Creates a merged cell from the TableRange. The value of a merged range is specified in the cell in the upper-left corner of the TableRange.

Throws:
java.lang.Exception
java.io.IOException

merge

public void merge(boolean across)
           throws java.lang.Exception,
                  java.io.IOException
Creates a merged cell from the TableRange. The value of a merged range is specified in the cell in the upper-left corner of the TableRange.

Parameters:
across - true to merge cells in each row of the TableRange as separate merged cells. The default value is false.
Throws:
java.lang.Exception
java.io.IOException