private function wrapUp($section)
    {
        $html = $this->cell;
        $this->cell = '';
        switch ($section) {
            case 'head':
                if ($this->head) {
                    $html .= '</tr>';
                } else {
                    if ($this->foot) {
                        $html .= '</tr></tfoot>';
                        $this->foot = false;
                    } elseif ($this->body) {
                        $html .= '</tr></tbody>';
                        $this->body = false;
                    }
                    $html .= '<thead>';
                }
                break;
            case 'foot':
                if ($this->foot) {
                    $html .= '</tr>';
                } else {
                    if ($this->head) {
                        $html .= '</tr></thead>';
                        $this->head = false;
                    } elseif ($this->body) {
                        $html .= '</tr></tbody>';
                        $this->body = false;
                    }
                    $html .= '<tfoot>';
                }
                break;
            case 'row':
                if ($this->body) {
                    $html .= '</tr>';
                } else {
                    if ($this->head) {
                        $html .= '</tr></thead>';
                        $this->head = false;
                    } elseif ($this->foot) {
                        $html .= '</tr></tfoot>';
                        $this->foot = false;
                    }
                    $html .= '<tbody>';
                }
                break;
            case 'table':
                if ($this->head) {
                    $html .= '</tr></thead>';
                } elseif ($this->foot) {
                    $html .= '</tr></tfoot>';
                } elseif ($this->body) {
                    $html .= '</tr></tbody>';
                }
                break;
        }

        return $html;
    }