ListObject

Inheritance: java.lang.Object

public class ListObject

Represents a table in 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 of this table.
getClass()
getComment()Gets the comment of the table.
getDataRange()Gets the data range of the Table.
getDataSourceType()Gets the data source type of the table.
getDisplayName()Gets the display name of the table.
getEndColumn()Gets the end column of the range.
getEndRow()Gets the end row of the range.
getListColumns()Gets the ListColumn list of this table.
getQueryTable()Gets the linked QueryTable.
getShowHeaderRow()Gets whether this Table shows header row.
getShowTableStyleColumnStripes()Indicates whether column stripe formatting is applied to.
getShowTableStyleFirstColumn()Indicates whether the first column in the table is the style applied to.
getShowTableStyleLastColumn()Indicates whether the last column in the table is the style applied to.
getShowTableStyleRowStripes()Indicates whether row stripe formatting is applied to.
getShowTotals()Gets whether this TAble shows 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.
hasAutoFilter()Indicates whether auto filter is applied to this table.
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.
removeAutoFilter()Removes auto filter which is applied to this table.
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 of the table.
setHasAutoFilter(boolean value)Indicates whether auto filter is applied to this table.
setShowHeaderRow(boolean value)Sets whether this Table shows header row.
setShowTableStyleColumnStripes(boolean value)Indicates whether column stripe formatting is applied to.
setShowTableStyleFirstColumn(boolean value)Indicates whether the first column in the table is the style applied to.
setShowTableStyleLastColumn(boolean value)Indicates whether the last column in the table is the style applied to.
setShowTableStyleRowStripes(boolean value)Indicates whether row stripe formatting is applied to.
setShowTotals(boolean value)Sets whether this TAble shows 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 to cells in the table.
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.

Remarks

NOTE: This member is now obsolete. Instead,please set ListObject.HasAutoFilter property./// This property will be removed 12 months later since October 2025. Aspose apologizes for any inconvenience you may have experienced.

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 of this table.

Remarks

It works only when hasAutoFilter() is false.

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 Table.

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 of the table.

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 the ListColumn list of this table.

Returns: ListColumnCollection

getQueryTable()

public QueryTable getQueryTable()

Gets the linked QueryTable.

Returns: QueryTable

getShowHeaderRow()

public boolean getShowHeaderRow()

Gets whether this Table shows header row.

Returns: boolean

getShowTableStyleColumnStripes()

public boolean getShowTableStyleColumnStripes()

Indicates whether column stripe formatting is applied to.

Returns: boolean

getShowTableStyleFirstColumn()

public boolean getShowTableStyleFirstColumn()

Indicates whether the first column in the table is the style applied to.

Returns: boolean

getShowTableStyleLastColumn()

public boolean getShowTableStyleLastColumn()

Indicates whether the last column in the table is the style applied to.

Returns: boolean

getShowTableStyleRowStripes()

public boolean getShowTableStyleRowStripes()

Indicates whether row stripe formatting is applied to.

Returns: boolean

getShowTotals()

public boolean getShowTotals()

Gets whether this TAble shows 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

hasAutoFilter()

public boolean hasAutoFilter()

Indicates whether auto filter is applied to this table.

Returns: boolean

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.

removeAutoFilter()

public void removeAutoFilter()

Removes auto filter which is applied to this table.

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 of the table.

Parameters:

ParameterTypeDescription
valuejava.lang.String

setHasAutoFilter(boolean value)

public void setHasAutoFilter(boolean value)

Indicates whether auto filter is applied to this table.

Parameters:

ParameterTypeDescription
valueboolean

setShowHeaderRow(boolean value)

public void setShowHeaderRow(boolean value)

Sets whether this Table shows header row.

Parameters:

ParameterTypeDescription
valueboolean

setShowTableStyleColumnStripes(boolean value)

public void setShowTableStyleColumnStripes(boolean value)

Indicates whether column stripe formatting is applied to.

Parameters:

ParameterTypeDescription
valueboolean

setShowTableStyleFirstColumn(boolean value)

public void setShowTableStyleFirstColumn(boolean value)

Indicates whether the first column in the table is the style applied to.

Parameters:

ParameterTypeDescription
valueboolean

setShowTableStyleLastColumn(boolean value)

public void setShowTableStyleLastColumn(boolean value)

Indicates whether the last column in the table is the style applied to.

Parameters:

ParameterTypeDescription
valueboolean

setShowTableStyleRowStripes(boolean value)

public void setShowTableStyleRowStripes(boolean value)

Indicates whether row stripe formatting is applied to.

Parameters:

ParameterTypeDescription
valueboolean

setShowTotals(boolean value)

public void setShowTotals(boolean value)

Sets whether this TAble shows 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 to cells in the table.

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