protected function buildTableStructure($table, $columnToAdd = null, $valueToAdd = null)
    {
        $i = $this->i;
        $someMetadata = false;
        $someIdSubTable = false;

        /*
         * table = array
         * ROW1 = col1 | col2 | col3 | metadata | idSubTable
         * ROW2 = col1 | col2 (no value but appears) | col3 | metadata | idSubTable
         */
        if (!($table instanceof DataTable)) {
            throw new Exception("HTML Renderer does not work with this combination of parameters");
        }
        foreach ($table->getRows() as $row) {
            if (isset($columnToAdd) && isset($valueToAdd)) {
                $this->allColumns[$columnToAdd] = true;
                $this->tableStructure[$i][$columnToAdd] = $valueToAdd;
            }

            foreach ($row->getColumns() as $column => $value) {
                $this->allColumns[$column] = true;
                $this->tableStructure[$i][$column] = $value;
            }

            $metadata = array();
            foreach ($row->getMetadata() as $name => $value) {
                if (is_string($value)) {
                    $value = "'$value'";
                } else if (is_array($value)) {
                    $value = var_export($value, true);
                }
                $metadata[] = "'$name' => $value";
            }

            if (count($metadata) != 0) {
                $someMetadata = true;
                $metadata = implode("<br />", $metadata);
                $this->tableStructure[$i]['_metadata'] = $metadata;
            }

            $idSubtable = $row->getIdSubDataTable();
            if (!is_null($idSubtable)) {
                $someIdSubTable = true;
                $this->tableStructure[$i]['_idSubtable'] = $idSubtable;
            }

            $i++;
        }
        $this->i = $i;

        $this->allColumns['_metadata'] = $someMetadata;
        $this->allColumns['_idSubtable'] = $someIdSubTable;
    }