Builds a table row.

@param  array  $colums       Array of column values
@param  array  $columnWidths Array of column widths
@return string
436602
protected function buildTableRow(array $colums, array $columnWidths): string
	{
		$cells = [];

		foreach(array_values($colums) as $key => $value)
		{
			$cells[] = $value . str_repeat(' ', $columnWidths[$key] - $this->stringWidthWithoutFormatting($value));
		}

		return '| ' . implode(' | ', $cells) . ' |' . PHP_EOL;
	}
454220
protected function getFormattedRow($rowData, $columnLengths, $header = false) {
        $response = $this->getChar('left');

        foreach ($rowData as $key => $field) {
            if ($header) {
                $color = $this->getHeaderColor();
            } else {
                $color = $this->fields[$key]['color'];
            }

            $fieldLength  = mb_strwidth($field) + 1;
            $field        = ' '.($this->getUseColors() ? $this->getColorFromName($color) : '').$field;
            $response    .= $field;

            for ($x = $fieldLength; $x < ($columnLengths[$key] + 2); $x++) {
                $response .= ' ';
            }
            $response .= $this->getChar('middle');
        }

        $response = substr($response, 0, strlen($response) - 3) . $this->getChar('right') . PHP_EOL;
        return $response;
    }
1198677
protected function renderTitle($title, $cellPadding, $columnsWidths) {
		$columnsNumber = count($columnsWidths);
		$tableWidth    = array_sum($columnsWidths) + $columnsNumber + ($columnsNumber * $cellPadding * 2) - 1;
		
		$content = '+' . str_repeat('-', $tableWidth) . '+' . PHP_EOL;
		
		$content .= '|';
		$content .= str_repeat(' ', $cellPadding);
		$content .= $title;
		$content .= str_repeat(' ', $tableWidth - $this->strlen($title) - $cellPadding);
		$content .= '|';
		
		return $content;
	}
183066
public static function build(Table $table, array $columns = [])
    {
        $index = new Index();
        $index->setColumns($columns);

        return new static($table, $index);
    }
450413
protected function getDefaultColumnWidths(array $columns)
    {
        $widths = $this->arrayOfStrLens(array_keys($columns));

        return array_combine(array_keys($columns), $widths);
    }
926197
public function buildTableRows($services)
    {
        $rows = array();
        foreach (array_keys($services) as $identifier) {
            try {
                $service = $this->resolveService($identifier);
                $rows[] = array(
                    $identifier,
                    $this->getServiceDescription($service),
                    $this->calculateServiceResolutionTime($identifier)
                );
            }
            catch (Exception $e) {
                $rows[] = array($identifier, 'Unable to resolve service.', 'N/A');
            }
        }
        return $rows;
    }
1113055
public void widthTable(XWPFTable table, float widthCM, int rows, int cols) {
        TableTools.widthTable(table, widthCM, cols);
        TableTools.borderTable(table, 4);
    }
397162
public function spansColumns(array $columnNames)
    {
        $columns         = $this->getColumns();
        $numberOfColumns = count($columns);
        $sameColumns     = true;

        for ($i = 0; $i < $numberOfColumns; $i++) {
            if (isset($columnNames[$i]) && $this->trimQuotes(strtolower($columns[$i])) === $this->trimQuotes(strtolower($columnNames[$i]))) {
                continue;
            }

            $sameColumns = false;
        }

        return $sameColumns;
    }
757091
@SuppressWarnings("unused")
    // TODO 
    private static void widthTable(XWPFTable table, float[] colWidths) {
        float widthCM = 0;
        for (float w : colWidths) {
            widthCM += w;
        }
        long width = (int) (widthCM / 2.54 * 1440);
        CTTblPr tblPr = getTblPr(table);
        CTTblWidth tblW = tblPr.isSetTblW() ? tblPr.getTblW() : tblPr.addNewTblW();
        tblW.setType(0 == width ? STTblWidth.AUTO : STTblWidth.DXA);
        tblW.setW(BigInteger.valueOf(width));

        if (0 != width) {
            CTTblGrid tblGrid = table.getCTTbl().getTblGrid();
            if (null == tblGrid) {
                tblGrid = table.getCTTbl().addNewTblGrid();
            }

            for (float w : colWidths) {
                CTTblGridCol addNewGridCol = tblGrid.addNewGridCol();
                addNewGridCol.setW(BigInteger.valueOf((long) (w / 2.54 * 1440)));
            }
        }
    }
1021825
public function getGridColumn($columns=null) {
		if($columns !== null) {
			foreach($columns as $val) {
				/*
				if(trim($val) == 'enabled') {
					$this->defaultColumns[] = array(
						'name'  => 'enabled',
						'value' => '$data->enabled == 1? "Ya": "Tidak"',
					);
				}
				*/
				$this->defaultColumns[] = $val;
			}
		} else {
			//$this->defaultColumns[] = 'comment_id';
			$this->defaultColumns[] = 'publish';
			$this->defaultColumns[] = 'parent_id';
			$this->defaultColumns[] = 'wall_id';
			$this->defaultColumns[] = 'user_id';
			$this->defaultColumns[] = 'comment';
			$this->defaultColumns[] = 'creation_date';
			$this->defaultColumns[] = 'modified_date';
		}

		return $this->defaultColumns;
	}
931232
public function setHeader(array $header_cols){
      $this->header = new TableHeader($header_cols);

      $this->updateMaxRowLength($this->header);
   }
1346840
private function makeTableBody($headers, $rows)
    {
        $body = [];
        $tableCellWidth = ($this->option('w')) ? $this->option('w') : 10;
        for ($i = 0; $i < count($rows); $i++) {
            $row = [];
            for ($j = 0; $j < count($headers); $j++) {
                $column = $headers[$j];
                $row[$j] = str_limit($rows[$i]->$column, $tableCellWidth, '');
            }
            $body[$i] = $row;
        }
        return $body;
    }
729310
private function getColumnWidth(array $headings)
    {
        $width = 0;
        foreach ($headings as $heading) {
            $width = strlen($heading) > $width ? strlen($heading) : $width;
        }

        return $width + 5;
    }
899882
protected function buildRowSeparator(array $columnWidths, string $separator = '-'): string
	{
		$columns = count($columnWidths);

		return str_repeat($separator, array_sum($columnWidths) + (($columns * 4) - ($columns - 1))) . PHP_EOL;
	}
491484
protected function buildColumns($columns)
    {
        if (!is_array($columns)) {
            if ($columns instanceof Aggregation) {
                $columns->setFieldsSql($this->buildColumns($columns->getFields()));

                return $this->getAdapter()->quoteSql($columns->toSQL());
            } elseif (false !== strpos($columns, '(')) {
                return $this->getAdapter()->quoteSql($columns);
            }
            $columns = preg_split('/\s*,\s*/', $columns, -1, PREG_SPLIT_NO_EMPTY);
        }
        foreach ($columns as $i => $column) {
            if ($column instanceof Expression) {
                $columns[$i] = $this->getAdapter()->quoteSql($column->toSQL());
            } elseif (false !== strpos($column, 'AS')) {
                if (preg_match('/^(.*?)(?i:\s+as\s+|\s+)([\w\-_\.]+)$/', $column, $matches)) {
                    list(, $rawColumn, $rawAlias) = $matches;
                    $columns[$i] = $this->getQuotedName($rawColumn).' AS '.$this->getQuotedName($rawAlias);
                }
            } elseif (false === strpos($column, '(')) {
                $columns[$i] = $this->getQuotedName($column);
            }
        }

        return is_array($columns) ? implode(', ', $columns) : $columns;
    }
764567
def max_column_widths(columns, header, opts = {})
      row_column_widths = columns.map do |c| 
        c.reduce(0) { |m, v| [m, v.nil? ? 0 : v.length].max }
      end

      header_column_widths = header.map { |h| h.length }

      row_column_widths = header_column_widths if row_column_widths.empty?

      widths = row_column_widths.zip(header_column_widths).map do |column|
        column.reduce(0) { |m, v| [m, v].max }
      end

      widths.empty? ? [] : scale_widths(widths, opts)
    end
1364683
private function calculateColumnWidths(array $rows) {
        $widths = [];

        foreach ($rows as $row) {
            if ($row['type'] !== '@row') {
                continue;
            }

            foreach ($row['cols'] as $colIndex => $col) {
                $currentWidth = array_get($widths, $colIndex, 0);
                $col = $this->output->format($col, OutputFormat::PLAIN);
                $width = strlen($col);

                if ($width > $currentWidth) {
                    $widths[$colIndex] = $width;
                }
            }
        }

        return $widths;
    }