public function print($row_key)
    {
        $this->calculateDimensions();
        $result = '';
        
        if ($this->getPrintHeader()) {
            $result .= $this->printHeader();
        } else {
            $result .= $this->printRowLine();
        }
        
        if (! is_null($row_key)) {
            $result .= $this->printRow($row_key, $this->getRows()[$row_key]);
        } else {
            foreach ($this->getRows() as $key => $data) {
                $result .= $this->printRow($key, $data);
            }
        }
        
        $result .= $this->printRowLine(false);
        
        return $result;
    }