public function render($str_pad_flag = STR_PAD_RIGHT)
    {
        $stacks = array();
        if ($this->column_size===0 && $this->line_size===0 && $this->cell_size===0) {
            $this->_parseTableSizes();
        }

        foreach (self::$_table_parts as $part) {
            if (!empty($this->{$part}) && is_array($this->{$part})) {
                $stacks[] = 'hseparator';
                foreach ($this->{$part} as $part_line) {
                    $stack_line = array();
                    $stack_line[] = 'vseparator';
                    foreach ($part_line as $i=>$part_cell) {
                        if (count($part_line)<$this->getColumnSize() && $i===count($part_line)-1) {
                            $stack_line[] = str_pad(' '.$part_cell, 
                                ( ($this->getColumnSize() - count($part_line) + 1) * $this->getCellSize())
                                     + ($this->getColumnSize() - count($part_line)), 
                                ' ', $str_pad_flag);
                        } else {
                            $stack_line[] = ' '.$part_cell.' ';
                        }
                        $stack_line[] = 'vseparator';
                    }
                    $stacks[] = $stack_line;
                }
            }
        }
        $stacks[] = 'hseparator';

        // special footer if no footer
        if (!count($this->tfoot)) {
            $stacks[] = array(
                'vseparator',
                str_pad(' '.$this->getSizesInfos(), ($this->getColumnSize() * $this->getCellSize())
                    + ($this->getColumnSize() - 1), ' ', $str_pad_flag),
                'vseparator'
            );
            $stacks[] = 'hseparator';
        }

        $str = '';
        if (!empty($this->title)) {
            $str .= $this->title."\n";
        }
        foreach ($stacks as $line) {
            $str .= "\n";
            if (is_array($line)) {
                foreach ($line as $cell) {
                    if ('vseparator'===$cell) {
                        $str .= '|';
                    } else {
                        $str .= str_pad($cell, $this->getCellSize(), ' ', $str_pad_flag);
                    }
                }
            } elseif ('hseparator'===$line) {
                for ($i=0; $i<$this->getColumnSize(); $i++) {
                    $str .= str_pad('+', ($this->getCellSize() + 1), '-');
                }
                $str .= '+';
            }
        }        
        return $str;
    }