WorkbookDesigner

Inheritance: java.lang.Object

public class WorkbookDesigner

Encapsulates the object that represents a designer spreadsheet.

Example

         //Create WorkbookDesigner object.
         WorkbookDesigner wd = new WorkbookDesigner();
         //Open the template file (which contains smart markers).
         wd.setWorkbook(new Workbook("SmartMarker_Designer.xls"));
 
         //Initialize your data from data source
         //DataSet ds = new DataSet();
         //...
 
         //Set the datatable as the data source.
         //wd.SetDataSource(dt);
         //Process the smart markers to fill the data into the worksheets.
         wd.process(true);
         //Save the excel file.
         wd.getWorkbook().save("outSmartMarker_Designer.xls");

Constructors

ConstructorDescription
WorkbookDesigner()Initializes a new instance of the WorkbookDesigner class.
WorkbookDesigner(Workbook workbook)Initializes a new instance of the WorkbookDesigner class.

Methods

MethodDescription
clearDataSource()Clears all data sources.
equals(Object arg0)
getCalculateFormula()Indicates whether formulas should be calculated.
getCallBack()Gets callback interface of processing smartmarker.
getClass()
getLineByLine()Indicates whether processing the smart marker line by line.
getRepeatFormulasWithSubtotal()Indicates whether repeating formulas with subtotal row.
getSmartMarkers()Returns a collection of smart markers in a spreadsheet.
getUpdateEmptyStringAsNull()If TRUE, Null will be inserted if the value is “”;
getUpdateReference()Indicates if references in other worksheets will be updated.
getWorkbook()Gets the Workbook object.
hashCode()
notify()
notifyAll()
process()Processes the smart markers and populates the data source values.
process(boolean isPreserved)Processes the smart markers and populates the data source values.
process(int sheetIndex, boolean isPreserved)Processes the smart markers and populates the data source values.
setCalculateFormula(boolean value)Indicates whether formulas should be calculated.
setCallBack(ISmartMarkerCallBack value)Sets callback interface of processing smartmarker.
setDataSource(String dataSource, ICellsDataTable cellsDataTable)Sets data source of a ICellsDataTable object.
setDataSource(String variable, Object data)Sets data binding to a variable.
setDataSource(String dataSource, ResultSet rs)Set the data source.
setDataSource(String dataSource, ResultSet rs, int rowCount)Set the data source.
setDataSource(ResultSet rs)Set the data source.
setJsonDataSource(String variable, String data)
setLineByLine(boolean value)Indicates whether processing the smart marker line by line.
setRepeatFormulasWithSubtotal(boolean value)Indicates whether repeating formulas with subtotal row.
setUpdateEmptyStringAsNull(boolean value)If TRUE, Null will be inserted if the value is “”;
setUpdateReference(boolean value)Indicates if references in other worksheets will be updated.
setWorkbook(Workbook value)Sets the Workbook object.
toString()
wait()
wait(long arg0)
wait(long arg0, int arg1)

WorkbookDesigner()

public WorkbookDesigner()

Initializes a new instance of the WorkbookDesigner class.

WorkbookDesigner(Workbook workbook)

public WorkbookDesigner(Workbook workbook)

Initializes a new instance of the WorkbookDesigner class.

Parameters:

ParameterTypeDescription
workbookWorkbookThe template workbook file.

clearDataSource()

public void clearDataSource()

Clears all data sources.

equals(Object arg0)

public boolean equals(Object arg0)

Parameters:

ParameterTypeDescription
arg0java.lang.Object

Returns: boolean

getCalculateFormula()

public boolean getCalculateFormula()

Indicates whether formulas should be calculated.

Returns: boolean

getCallBack()

public ISmartMarkerCallBack getCallBack()

Gets callback interface of processing smartmarker.

Returns: ISmartMarkerCallBack

getClass()

public final native Class<?> getClass()

Returns: java.lang.Class

getLineByLine()

public boolean getLineByLine()

Indicates whether processing the smart marker line by line.

Remarks

The default value is true. If False, the template file must contain a range which is named as “_CellsSmartMarkers”.

Returns: boolean

getRepeatFormulasWithSubtotal()

public boolean getRepeatFormulasWithSubtotal()

Indicates whether repeating formulas with subtotal row.

Returns: boolean

getSmartMarkers()

public String[] getSmartMarkers()

Returns a collection of smart markers in a spreadsheet.

Remarks

A string array is created on every call. The array is sorted and duplicated values are removed.

Returns: java.lang.String[] - A collection of smart markers

getUpdateEmptyStringAsNull()

public boolean getUpdateEmptyStringAsNull()

If TRUE, Null will be inserted if the value is “”;

Returns: boolean

getUpdateReference()

public boolean getUpdateReference()

Indicates if references in other worksheets will be updated.

Returns: boolean

getWorkbook()

public Workbook getWorkbook()

Gets the Workbook object.

Returns: Workbook

hashCode()

public native int hashCode()

Returns: int

notify()

public final native void notify()

notifyAll()

public final native void notifyAll()

process()

public void process()

Processes the smart markers and populates the data source values.

process(boolean isPreserved)

public void process(boolean isPreserved)

Processes the smart markers and populates the data source values.

Parameters:

ParameterTypeDescription
isPreservedbooleanTrue if the unrecognized smart marker is preserved.

process(int sheetIndex, boolean isPreserved)

public void process(int sheetIndex, boolean isPreserved)

Processes the smart markers and populates the data source values.

Remarks

This method works on worksheet level.

Parameters:

ParameterTypeDescription
sheetIndexintWorksheet index.
isPreservedbooleanTrue if the unrecognized smart marker is preserved.

setCalculateFormula(boolean value)

public void setCalculateFormula(boolean value)

Indicates whether formulas should be calculated.

Parameters:

ParameterTypeDescription
valueboolean

setCallBack(ISmartMarkerCallBack value)

public void setCallBack(ISmartMarkerCallBack value)

Sets callback interface of processing smartmarker.

Parameters:

ParameterTypeDescription
valueISmartMarkerCallBack

setDataSource(String dataSource, ICellsDataTable cellsDataTable)

public void setDataSource(String dataSource, ICellsDataTable cellsDataTable)

Sets data source of a ICellsDataTable object.

Parameters:

ParameterTypeDescription
dataSourcejava.lang.StringThe name of the data source.
cellsDataTableICellsDataTabledata table.

setDataSource(String variable, Object data)

public void setDataSource(String variable, Object data)

Sets data binding to a variable.

Parameters:

ParameterTypeDescription
variablejava.lang.StringVariable name created using smart marker.
datajava.lang.ObjectSource data.

setDataSource(String dataSource, ResultSet rs)

public void setDataSource(String dataSource, ResultSet rs)

Set the data source.

Parameters:

ParameterTypeDescription
dataSourcejava.lang.StringThe name of the data source.
rsjava.sql.ResultSetThe result set.

setDataSource(String dataSource, ResultSet rs, int rowCount)

public void setDataSource(String dataSource, ResultSet rs, int rowCount)

Set the data source.

Parameters:

ParameterTypeDescription
dataSourcejava.lang.StringThe name of the data source.
rsjava.sql.ResultSetThe result set.
rowCountintThe data count of given resultset. It should be the exact row count or -1; If the resultset is forward only, user should give the exact row count here, otherwise the smart may not be processed correctly when the smart marker’s “noadd” is not set.

setDataSource(ResultSet rs)

public void setDataSource(ResultSet rs)

Set the data source.

Parameters:

ParameterTypeDescription
rsjava.sql.ResultSetThe result set.

setJsonDataSource(String variable, String data)

public void setJsonDataSource(String variable, String data)

Parameters:

ParameterTypeDescription
variablejava.lang.String
datajava.lang.String

setLineByLine(boolean value)

public void setLineByLine(boolean value)

Indicates whether processing the smart marker line by line.

Remarks

The default value is true. If False, the template file must contain a range which is named as “_CellsSmartMarkers”.

Parameters:

ParameterTypeDescription
valueboolean

setRepeatFormulasWithSubtotal(boolean value)

public void setRepeatFormulasWithSubtotal(boolean value)

Indicates whether repeating formulas with subtotal row.

Parameters:

ParameterTypeDescription
valueboolean

setUpdateEmptyStringAsNull(boolean value)

public void setUpdateEmptyStringAsNull(boolean value)

If TRUE, Null will be inserted if the value is “”;

Parameters:

ParameterTypeDescription
valueboolean

setUpdateReference(boolean value)

public void setUpdateReference(boolean value)

Indicates if references in other worksheets will be updated.

Parameters:

ParameterTypeDescription
valueboolean

setWorkbook(Workbook value)

public void setWorkbook(Workbook value)

Sets the Workbook object.

Parameters:

ParameterTypeDescription
valueWorkbook

toString()

public String toString()

Returns: java.lang.String

wait()

public final void wait()

wait(long arg0)

public final native void wait(long arg0)

Parameters:

ParameterTypeDescription
arg0long

wait(long arg0, int arg1)

public final void wait(long arg0, int arg1)

Parameters:

ParameterTypeDescription
arg0long
arg1int