You can add data cells with {@link addCell()}. Call {@link fit()} to fit
the cells into a given maximum width and number of columns.
You can access the rows with the wrapped cells with {@link getWrappedRows()}.
private function getCellWrapper(Formatter $formatter, $screenWidth, $excessColumnWidth, $indentation) { $borderStyle = $this->style->getBorderStyle(); $borderWidth = StringUtil::getLength($borderStyle->getLineVLChar()) + ($this->nbColumns - 1) * StringUtil::getLength($borderStyle->getLineVCChar()) + StringUtil::getLength($borderStyle->getLineVRChar()); $availableWidth = $screenWidth - $indentation - $borderWidth - $this->nbColumns * $excessColumnWidth; $wrapper = new CellWrapper(); foreach ($this->headerRow as $headerCell) { $wrapper->addCell($headerCell); } foreach ($this->rows as $row) { foreach ($row as $cell) { $wrapper->addCell($cell); } } $wrapper->fit($availableWidth, $this->nbColumns, $formatter); return $wrapper; }
private function getCellWrapper(Formatter $formatter, $screenWidth, $excessColumnWidth, $indentation) { $borderStyle = $this->style->getBorderStyle(); $wrapper = new CellWrapper(); foreach ($this->cells as $cell) { $wrapper->addCell($cell); } $nbColumns = min($this->maxNbColumns, $wrapper->getEstimatedNbColumns($screenWidth)); do { $borderWidth = StringUtil::getLength($borderStyle->getLineVLChar()) + ($nbColumns - 1) * StringUtil::getLength($borderStyle->getLineVCChar()) + StringUtil::getLength($borderStyle->getLineVRChar()); $availableWidth = $screenWidth - $indentation - $borderWidth - $nbColumns * $excessColumnWidth; $wrapper->fit($availableWidth, $nbColumns, $formatter); --$nbColumns; } while ($wrapper->hasWordCuts() && $nbColumns >= $this->minNbColumns); return $wrapper; }