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 | ||
|---|---|---|
function | getAlternativeDescription() | |
function | setAlternativeDescription(value) | |
| Gets and sets the alternative description. | ||
function | getAlternativeText() | |
function | setAlternativeText(value) | |
| Gets and sets the alternative text. | ||
function | getAutoFilter() | |
| Gets auto filter. | ||
function | getComment() | |
function | setComment(value) | |
| Gets and sets the comment of the table. | ||
function | getDataRange() | |
| Gets the data range of the ListObject. | ||
function | getDataSourceType() | |
| Gets the data source type of the table. The value of the property is TableDataSourceType integer constant. | ||
function | getDisplayName() | |
function | setDisplayName(value) | |
| Gets and sets the display name. | ||
function | getEndColumn() | |
| Gets the end column of the range. | ||
function | getEndRow() | |
| Gets the end row of the range. | ||
function | getListColumns() | |
| Gets ListColumns of the ListObject. | ||
function | getQueryTable() | |
| Gets the linked QueryTable. | ||
function | getShowHeaderRow() | |
function | setShowHeaderRow(value) | |
| Gets and sets whether this ListObject show header row. | ||
function | getShowTableStyleColumnStripes() | |
function | setShowTableStyleColumnStripes(value) | |
| Indicates whether column stripe formatting is applied. | ||
function | getShowTableStyleFirstColumn() | |
function | setShowTableStyleFirstColumn(value) | |
| Inidicates whether the first column in the table should have the style applied. | ||
function | getShowTableStyleLastColumn() | |
function | setShowTableStyleLastColumn(value) | |
| Indicates whether the last column in the table should have the style applied. | ||
function | getShowTableStyleRowStripes() | |
function | setShowTableStyleRowStripes(value) | |
| Indicates whether row stripe formatting is applied. | ||
function | getShowTotals() | |
function | setShowTotals(value) | |
| Gets and sets whether this ListObject show total row. | ||
function | getStartColumn() | |
| Gets the start column of the range. | ||
function | getStartRow() | |
| Gets the start row of the range. | ||
function | getTableStyleName() | |
function | setTableStyleName(value) | |
| Gets and sets the table style name. | ||
function | getTableStyleType() | |
function | setTableStyleType(value) | |
| Gets and the built-in table style. The value of the property is TableStyleType integer constant. | ||
function | getXmlMap() | |
|
Gets an |
||
| Method Summary | ||
|---|---|---|
function | applyStyleToRange() | |
| Apply the table style to the range. | ||
function | convertToRange() | |
| Convert the table to range. | ||
function | convertToRange(options) | |
| Convert the table to range. | ||
function | putCellValue(rowOffset, columnOffset, value) | |
| Put the value to the cell. | ||
function | resize(startRow, startColumn, endRow, endColumn, hasHeaders) | |
| Resize the range of the list object. | ||
function | updateColumnName() | |
| Updates all list columns' name from the worksheet. | ||
| Property Getters/Setters Detail |
|---|
getStartRow : Number | |
function getStartRow() | |
getStartColumn : Number | |
function getStartColumn() | |
getEndRow : Number | |
function getEndRow() | |
getEndColumn : Number | |
function getEndColumn() | |
getListColumns : ListColumnCollection | |
function getListColumns() | |
getShowHeaderRow/setShowHeaderRow : boolean | |
function getShowHeaderRow() / function setShowHeaderRow(value) | |
getShowTotals/setShowTotals : boolean | |
function getShowTotals() / function setShowTotals(value) | |
getDataRange : Range | |
function getDataRange() | |
getQueryTable : QueryTable | |
function getQueryTable() | |
getDataSourceType : Number | |
function getDataSourceType() | |
getAutoFilter : AutoFilter | |
function getAutoFilter() | |
getDisplayName/setDisplayName : String | |
function getDisplayName() / function setDisplayName(value) | |
getComment/setComment : String | |
function getComment() / function setComment(value) | |
getShowTableStyleFirstColumn/setShowTableStyleFirstColumn : boolean | |
function getShowTableStyleFirstColumn() / function setShowTableStyleFirstColumn(value) | |
getShowTableStyleLastColumn/setShowTableStyleLastColumn : boolean | |
function getShowTableStyleLastColumn() / function setShowTableStyleLastColumn(value) | |
getShowTableStyleRowStripes/setShowTableStyleRowStripes : boolean | |
function getShowTableStyleRowStripes() / function setShowTableStyleRowStripes(value) | |
getShowTableStyleColumnStripes/setShowTableStyleColumnStripes : boolean | |
function getShowTableStyleColumnStripes() / function setShowTableStyleColumnStripes(value) | |
getTableStyleType/setTableStyleType : Number | |
function getTableStyleType() / function setTableStyleType(value) | |
getTableStyleName/setTableStyleName : String | |
function getTableStyleName() / function setTableStyleName(value) | |
getXmlMap : XmlMap | |
function getXmlMap() | |
getAlternativeText/setAlternativeText : String | |
function getAlternativeText() / function setAlternativeText(value) | |
getAlternativeDescription/setAlternativeDescription : String | |
function getAlternativeDescription() / function setAlternativeDescription(value) | |
| Method Detail |
|---|
resize | |
function resize(startRow, startColumn, endRow, endColumn, hasHeaders) | |
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 the ListObject has has headers.putCellValue | |
function putCellValue(rowOffset, columnOffset, value) | |
rowOffset: Number - The row offset.columnOffset: Number - The column offset.value: Object - The cell value.updateColumnName | |
function updateColumnName() | |
applyStyleToRange | |
function applyStyleToRange() | |
convertToRange | |
function convertToRange() | |
convertToRange | |
function convertToRange(options) | |
options: TableToRangeOptions - the options when converting table to range.