ListObject

Inheritance: java.lang.Object

public class ListObject

Represents a list object on a worksheet. The ListObject object is a member of the ListObjects collection. The ListObjects collection contains all the list objects on a worksheet.

Example

         Workbook workbook = new Workbook();
         Cells cells = workbook.getWorksheets().get(0).getCells();
         for (int i = 0; i  ? i++)
         {
         cells.get(0,i).putValue(CellsHelper.columnIndexToName(i));
          }
         for (int row = 1; row  ? row++)
         {
          for (int column = 0; column  ? column++)
         {
         cells.get(row, column).putValue(row * column);
          }
          }
         ListObjectCollection tables = workbook.getWorksheets().get(0).getListObjects();
         int index = tables.add(0, 0, 9, 4, true);
         ListObject table = tables.get(0);
         table.setShowTotals(true);
         table.getListColumns().get(4).setTotalsCalculation(com.aspose.cells.TotalsCalculation.SUM);
         workbook.save("Book1.xlsx");

Methods

MethodDescription
applyStyleToRange()Apply the table style to the range.
convertToRange()Convert the table to range.
convertToRange(TableToRangeOptions options)Convert the table to range.
equals(Object arg0)
filter()Filter the table.
getAlternativeDescription()Gets the alternative description.
getAlternativeText()Gets the alternative text.
getAutoFilter()Gets auto filter.
getClass()
getComment()Gets the comment of the table.
getDataRange()Gets the data range of the ListObject.
getDataSourceType()Gets the data source type of the table.
getDisplayName()Gets the display name.
getEndColumn()Gets the end column of the range.
getEndRow()Gets the end row of the range.
getListColumns()Gets ListColumns of the ListObject.
getQueryTable()Gets the linked QueryTable.
getShowHeaderRow()Gets whether this ListObject show header row.
getShowTableStyleColumnStripes()Indicates whether column stripe formatting is applied.
getShowTableStyleFirstColumn()Indicates whether the first column in the table should have the style applied.
getShowTableStyleLastColumn()Indicates whether the last column in the table should have the style applied.
getShowTableStyleRowStripes()Indicates whether row stripe formatting is applied.
getShowTotals()Gets whether this ListObject show total row.
getStartColumn()Gets the start column of the range.
getStartRow()Gets the start row of the range.
getTableStyleName()Gets the table style name.
getTableStyleType()Gets and the built-in table style.
getXmlMap()Gets an getXmlMap() used for this list.
hashCode()
notify()
notifyAll()
putCellFormula(int rowOffset, int columnOffset, String formula)Put the formula to the cell in the table.
putCellFormula(int rowOffset, int columnOffset, String formula, boolean isTotalsRowFormula)Put the formula to the cell in the table.
putCellValue(int rowOffset, int columnOffset, Object value)Put the value to the cell.
putCellValue(int rowOffset, int columnOffset, Object value, boolean isTotalsRowLabel)Put the value to the cell.
resize(int startRow, int startColumn, int endRow, int endColumn, boolean hasHeaders)Resize the range of the list object.
setAlternativeDescription(String value)Sets the alternative description.
setAlternativeText(String value)Sets the alternative text.
setComment(String value)Sets the comment of the table.
setDisplayName(String value)Sets the display name.
setShowHeaderRow(boolean value)Sets whether this ListObject show header row.
setShowTableStyleColumnStripes(boolean value)Indicates whether column stripe formatting is applied.
setShowTableStyleFirstColumn(boolean value)Indicates whether the first column in the table should have the style applied.
setShowTableStyleLastColumn(boolean value)Indicates whether the last column in the table should have the style applied.
setShowTableStyleRowStripes(boolean value)Indicates whether row stripe formatting is applied.
setShowTotals(boolean value)Sets whether this ListObject show total row.
setTableStyleName(String value)Sets the table style name.
setTableStyleType(int value)Gets and the built-in table style.
toString()
updateColumnName()Updates all list columns’ name from the worksheet.
wait()
wait(long arg0)
wait(long arg0, int arg1)

applyStyleToRange()

public void applyStyleToRange()

Apply the table style to the range.

convertToRange()

public void convertToRange()

Convert the table to range.

convertToRange(TableToRangeOptions options)

public void convertToRange(TableToRangeOptions options)

Convert the table to range.

Parameters:

ParameterTypeDescription
optionsTableToRangeOptionsthe options when converting table to range.

equals(Object arg0)

public boolean equals(Object arg0)

Parameters:

ParameterTypeDescription
arg0java.lang.Object

Returns: boolean

filter()

public AutoFilter filter()

Filter the table.

Returns: AutoFilter

getAlternativeDescription()

public String getAlternativeDescription()

Gets the alternative description.

Returns: java.lang.String

getAlternativeText()

public String getAlternativeText()

Gets the alternative text.

Returns: java.lang.String

getAutoFilter()

public AutoFilter getAutoFilter()

Gets auto filter.

Returns: AutoFilter

getClass()

public final native Class<?> getClass()

Returns: java.lang.Class

getComment()

public String getComment()

Gets the comment of the table.

Returns: java.lang.String

getDataRange()

public Range getDataRange()

Gets the data range of the ListObject.

Returns: Range

getDataSourceType()

public int getDataSourceType()

Gets the data source type of the table.

See TableDataSourceType.

Returns: int

getDisplayName()

public String getDisplayName()

Gets the display name.

Returns: java.lang.String

getEndColumn()

public int getEndColumn()

Gets the end column of the range.

Returns: int

getEndRow()

public int getEndRow()

Gets the end row of the range.

Returns: int

getListColumns()

public ListColumnCollection getListColumns()

Gets ListColumns of the ListObject.

Returns: ListColumnCollection

getQueryTable()

public QueryTable getQueryTable()

Gets the linked QueryTable.

Returns: QueryTable

getShowHeaderRow()

public boolean getShowHeaderRow()

Gets whether this ListObject show header row.

Returns: boolean

getShowTableStyleColumnStripes()

public boolean getShowTableStyleColumnStripes()

Indicates whether column stripe formatting is applied.

Returns: boolean

getShowTableStyleFirstColumn()

public boolean getShowTableStyleFirstColumn()

Indicates whether the first column in the table should have the style applied.

Returns: boolean

getShowTableStyleLastColumn()

public boolean getShowTableStyleLastColumn()

Indicates whether the last column in the table should have the style applied.

Returns: boolean

getShowTableStyleRowStripes()

public boolean getShowTableStyleRowStripes()

Indicates whether row stripe formatting is applied.

Returns: boolean

getShowTotals()

public boolean getShowTotals()

Gets whether this ListObject show total row.

Returns: boolean

getStartColumn()

public int getStartColumn()

Gets the start column of the range.

Returns: int

getStartRow()

public int getStartRow()

Gets the start row of the range.

Returns: int

getTableStyleName()

public String getTableStyleName()

Gets the table style name.

Returns: java.lang.String

getTableStyleType()

public int getTableStyleType()

Gets and the built-in table style.

See TableStyleType.

Example

         Workbook workbook = new Workbook("Book1.xlsx");
         ListObjectCollection tables = workbook.getWorksheets().get(0).getListObjects();
         int index = tables.add(0, 0, 9, 4, true);
         ListObject table = tables.get(0);
         table.setTableStyleType(TableStyleType.TABLE_STYLE_DARK_2);
          workbook.save("TableStyle.xlsx");

Returns: int

getXmlMap()

public XmlMap getXmlMap()

Gets an getXmlMap() used for this list.

Returns: XmlMap

hashCode()

public native int hashCode()

Returns: int

notify()

public final native void notify()

notifyAll()

public final native void notifyAll()

putCellFormula(int rowOffset, int columnOffset, String formula)

public void putCellFormula(int rowOffset, int columnOffset, String formula)

Put the formula to the cell in the table.

Parameters:

ParameterTypeDescription
rowOffsetintThe row offset in the table.
columnOffsetintThe column offset in the table.
formulajava.lang.StringThe formula of the cell.

putCellFormula(int rowOffset, int columnOffset, String formula, boolean isTotalsRowFormula)

public void putCellFormula(int rowOffset, int columnOffset, String formula, boolean isTotalsRowFormula)

Put the formula to the cell in the table.

Parameters:

ParameterTypeDescription
rowOffsetintThe row offset in the table.
columnOffsetintThe column offset in the table.
formulajava.lang.StringThe formula of the cell.
isTotalsRowFormulaboolean

putCellValue(int rowOffset, int columnOffset, Object value)

public void putCellValue(int rowOffset, int columnOffset, Object value)

Put the value to the cell.

Parameters:

ParameterTypeDescription
rowOffsetintThe row offset in the table.
columnOffsetintThe column offset in the table.
valuejava.lang.ObjectThe cell value.

putCellValue(int rowOffset, int columnOffset, Object value, boolean isTotalsRowLabel)

public void putCellValue(int rowOffset, int columnOffset, Object value, boolean isTotalsRowLabel)

Put the value to the cell.

Parameters:

ParameterTypeDescription
rowOffsetintThe row offset in the table.
columnOffsetintThe column offset in the table.
valuejava.lang.ObjectThe cell value.
isTotalsRowLabelbooleanIndicates whether it is a label for total row,only works for total row. If False and this row is total row, a new row will be inserted.

resize(int startRow, int startColumn, int endRow, int endColumn, boolean hasHeaders)

public void resize(int startRow, int startColumn, int endRow, int endColumn, boolean hasHeaders)

Resize the range of the list object.

Parameters:

ParameterTypeDescription
startRowintThe start row index of the new range.
startColumnintThe start column index of the new range.
endRowintThe end row index of the new range.
endColumnintThe end column index of the new range.
hasHeadersbooleanWhether this table has headers.

setAlternativeDescription(String value)

public void setAlternativeDescription(String value)

Sets the alternative description.

Parameters:

ParameterTypeDescription
valuejava.lang.String

setAlternativeText(String value)

public void setAlternativeText(String value)

Sets the alternative text.

Parameters:

ParameterTypeDescription
valuejava.lang.String

setComment(String value)

public void setComment(String value)

Sets the comment of the table.

Parameters:

ParameterTypeDescription
valuejava.lang.String

setDisplayName(String value)

public void setDisplayName(String value)

Sets the display name.

Parameters:

ParameterTypeDescription
valuejava.lang.String

setShowHeaderRow(boolean value)

public void setShowHeaderRow(boolean value)

Sets whether this ListObject show header row.

Parameters:

ParameterTypeDescription
valueboolean

setShowTableStyleColumnStripes(boolean value)

public void setShowTableStyleColumnStripes(boolean value)

Indicates whether column stripe formatting is applied.

Parameters:

ParameterTypeDescription
valueboolean

setShowTableStyleFirstColumn(boolean value)

public void setShowTableStyleFirstColumn(boolean value)

Indicates whether the first column in the table should have the style applied.

Parameters:

ParameterTypeDescription
valueboolean

setShowTableStyleLastColumn(boolean value)

public void setShowTableStyleLastColumn(boolean value)

Indicates whether the last column in the table should have the style applied.

Parameters:

ParameterTypeDescription
valueboolean

setShowTableStyleRowStripes(boolean value)

public void setShowTableStyleRowStripes(boolean value)

Indicates whether row stripe formatting is applied.

Parameters:

ParameterTypeDescription
valueboolean

setShowTotals(boolean value)

public void setShowTotals(boolean value)

Sets whether this ListObject show total row.

Parameters:

ParameterTypeDescription
valueboolean

setTableStyleName(String value)

public void setTableStyleName(String value)

Sets the table style name.

Parameters:

ParameterTypeDescription
valuejava.lang.String

setTableStyleType(int value)

public void setTableStyleType(int value)

Gets and the built-in table style.

See TableStyleType.

Parameters:

ParameterTypeDescription
valueint

toString()

public String toString()

Returns: java.lang.String

updateColumnName()

public void updateColumnName()

Updates all list columns’ name from the worksheet.

Remarks

The value of the cells in the header row of the table must be same as the name of the ListColumn; Cell.PutValue do not auto modify the name of the ListColumn for performance.

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