aspose.cells

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 = new cells\Workbook();
$cells = $workbook->getWorksheets()->get(0)->getCells();
for ($i = 0; $i < 5; $i++)
{
    $cells->get(0, $i)->putValue(cells\CellsHelper::columnIndexToName($i));
}
for ($row = 1; $row < 10; $row++)
{
    for ($column = 0; $column < 5; $column++)
    {
        $cells->get($row, $column)->putValue($row * $column);
    }
}
$tables = $workbook->getWorksheets()->get(0)->getListObjects();
$index = $tables->add(0, 0, 9, 4, true);
$table = $tables->get(0);
$table->setShowTotals(true);
$table->getListColumns()->get(4)->setTotalsCalculation(cells\TotalsCalculation::SUM);

Property Getters/Setters Summary
functiongetAlternativeDescription()
function
           Gets and sets the alternative description.
functiongetAlternativeText()
function
           Gets and sets the alternative text.
functiongetAutoFilter()
Gets auto filter.
functiongetComment()
function
setComment(value)
           Gets and sets the comment of the table.
functiongetDataRange()
Gets the data range of the ListObject.
functiongetDataSourceType()
Gets the data source type of the table. The value of the property is TableDataSourceType integer constant.
functiongetDisplayName()
function
           Gets and sets the display name.
functiongetEndColumn()
Gets the end column of the range.
functiongetEndRow()
Gets the end row of the range.
functiongetListColumns()
Gets ListColumns of the ListObject.
functiongetQueryTable()
Gets the linked QueryTable.
functiongetShowHeaderRow()
function
           Gets and sets whether this ListObject show header row.
functiongetShowTableStyleColumnStripes()
function
           Indicates whether column stripe formatting is applied.
functiongetShowTableStyleFirstColumn()
function
           Indicates whether the first column in the table should have the style applied.
functiongetShowTableStyleLastColumn()
function
           Indicates whether the last column in the table should have the style applied.
functiongetShowTableStyleRowStripes()
function
           Indicates whether row stripe formatting is applied.
functiongetShowTotals()
function
           Gets and sets whether this ListObject show total row.
functiongetStartColumn()
Gets the start column of the range.
functiongetStartRow()
Gets the start row of the range.
functiongetTableStyleName()
function
           Gets and sets the table style name.
functiongetTableStyleType()
function
           Gets and the built-in table style. The value of the property is TableStyleType integer constant.
functiongetXmlMap()
Gets an XmlMap used for this list.
 
Method Summary
functionapplyStyleToRange()
Apply the table style to the range.
functionconvertToRange()
Convert the table to range.
functionconvertToRange(options)
Convert the table to range.
functionfilter()
Filter the table.
functionputCellFormula(rowOffset, columnOffset, formula)
Put the formula to the cell in the table.
functionputCellFormula(rowOffset, columnOffset, formula, isTotalsRowFormula)
Put the formula to the cell in the table.
functionputCellValue(rowOffset, columnOffset, value)
Put the value to the cell.
functionputCellValue(rowOffset, columnOffset, value, isTotalsRowLabel)
Put the value to the cell.
functionresize(startRow, startColumn, endRow, endColumn, hasHeaders)
Resize the range of the list object.
functionupdateColumnName()
Updates all list columns' name from the worksheet.
 

    • Property Getters/Setters Detail

      • getStartRow : Number 

        function getStartRow()
        
        Gets the start row of the range.
      • getStartColumn : Number 

        function getStartColumn()
        
        Gets the start column of the range.
      • getEndRow : Number 

        function getEndRow()
        
        Gets the end row of the range.
      • getEndColumn : Number 

        function getEndColumn()
        
        Gets the end column of the range.
      • getListColumns : ListColumnCollection 

        function getListColumns()
        
        Gets ListColumns of the ListObject.
      • getShowHeaderRow/setShowHeaderRow : boolean 

        function getShowHeaderRow() / function setShowHeaderRow(value)
        
        Gets and sets whether this ListObject show header row.
      • getShowTotals/setShowTotals : boolean 

        function getShowTotals() / function setShowTotals(value)
        
        Gets and sets whether this ListObject show total row.
      • getDataRange : Range 

        function getDataRange()
        
        Gets the data range of the ListObject.
      • getQueryTable : QueryTable 

        function getQueryTable()
        
        Gets the linked QueryTable.
      • getDataSourceType : Number 

        function getDataSourceType()
        
        Gets the data source type of the table. The value of the property is TableDataSourceType integer constant.
      • getAutoFilter : AutoFilter 

        function getAutoFilter()
        
        Gets auto filter.
      • getDisplayName/setDisplayName : String 

        function getDisplayName() / function setDisplayName(value)
        
        Gets and sets the display name.
      • getComment/setComment : String 

        function getComment() / function setComment(value)
        
        Gets and sets the comment of the table.
      • getShowTableStyleFirstColumn/setShowTableStyleFirstColumn : boolean 

        function getShowTableStyleFirstColumn() / function setShowTableStyleFirstColumn(value)
        
        Indicates whether the first column in the table should have the style applied.
      • getShowTableStyleLastColumn/setShowTableStyleLastColumn : boolean 

        function getShowTableStyleLastColumn() / function setShowTableStyleLastColumn(value)
        
        Indicates whether the last column in the table should have the style applied.
      • getShowTableStyleRowStripes/setShowTableStyleRowStripes : boolean 

        function getShowTableStyleRowStripes() / function setShowTableStyleRowStripes(value)
        
        Indicates whether row stripe formatting is applied.
      • getShowTableStyleColumnStripes/setShowTableStyleColumnStripes : boolean 

        function getShowTableStyleColumnStripes() / function setShowTableStyleColumnStripes(value)
        
        Indicates whether column stripe formatting is applied.
      • getTableStyleType/setTableStyleType : Number 

        function getTableStyleType() / function setTableStyleType(value)
        
        Gets and the built-in table style. The value of the property is TableStyleType integer constant.
      • getTableStyleName/setTableStyleName : String 

        function getTableStyleName() / function setTableStyleName(value)
        
        Gets and sets the table style name.
      • getXmlMap : XmlMap 

        function getXmlMap()
        
        Gets an XmlMap used for this list.
      • getAlternativeText/setAlternativeText : String 

        function getAlternativeText() / function setAlternativeText(value)
        
        Gets and sets the alternative text.
      • getAlternativeDescription/setAlternativeDescription : String 

        function getAlternativeDescription() / function setAlternativeDescription(value)
        
        Gets and sets the alternative description.
    • Method Detail

      • resize

        function resize(startRow, startColumn, endRow, endColumn, hasHeaders)
        Resize the range of the list object.
        Parameters:
        startRow: Number - The start row index of the new range.
        startColumn: Number - The start column index of the new range.
        endRow: Number - The end row index of the new range.
        endColumn: Number - The end column index of the new range.
        hasHeaders: boolean - Whether this table has headers.
      • putCellValue

        function putCellValue(rowOffset, columnOffset, value)
        Put the value to the cell.
        Parameters:
        rowOffset: Number - The row offset in the table.
        columnOffset: Number - The column offset in the table.
        value: Object - The cell value.
      • putCellValue

        function putCellValue(rowOffset, columnOffset, value, isTotalsRowLabel)
        Put the value to the cell.
        Parameters:
        rowOffset: Number - The row offset in the table.
        columnOffset: Number - The column offset in the table.
        value: Object - The cell value.
        isTotalsRowLabel: boolean - Indicates 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.
      • putCellFormula

        function putCellFormula(rowOffset, columnOffset, formula)
        Put the formula to the cell in the table.
        Parameters:
        rowOffset: Number - The row offset in the table.
        columnOffset: Number - The column offset in the table.
        formula: String - The formula of the cell.
      • putCellFormula

        function putCellFormula(rowOffset, columnOffset, formula, isTotalsRowFormula)
        Put the formula to the cell in the table.
        Parameters:
        rowOffset: Number - The row offset in the table.
        columnOffset: Number - The column offset in the table.
        formula: String - The formula of the cell.
        isTotalsRowFormula: boolean -
      • updateColumnName

        function updateColumnName()
        Updates all list columns' name from the worksheet. 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.
      • filter

        function filter()
        Filter the table.
      • applyStyleToRange

        function applyStyleToRange()
        Apply the table style to the range.
      • convertToRange

        function convertToRange()
        Convert the table to range.
      • convertToRange

        function convertToRange(options)
        Convert the table to range.
        Parameters:
        options: TableToRangeOptions - the options when converting table to range.