HTML_Table::setCellContents() – Set cell content


require_once 'HTML/Table.php';

void HTML_Table::setCellContents ( int $row , int $col , mixed $contents , string $type='TD' , int $body=0 )


Sets the cell contents for an existing cell. If the given indices do not exist and autoGrow is TRUE then the given row and/or column is automatically added. If autoGrow is FALSE, then an error is returned.


  • int $row - Row index

  • int $col - Column index

  • mixed $contents - May contain HTML or any object with a toHTML() method

  • string $type - Cell type either 'th' or 'td'

  • int $body - The number of the tbody group that should be used


Possible PEAR_Error values
Error code Error message Meaning Solution
  " Invalid table row reference [$row] " The row $row does not exists Enable the autoGrow feature
  " Invalid table column reference [$column] " The column $column does not exists Enable the autoGrow feature


This function can not be called statically.

Set cell attributes (Previous) Set column attributes (Next)
Last updated: Sat, 16 Feb 2019 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report.
View this page in:
  • English

User Notes:

There are no user contributed notes for this page.