Draws a table.

@param array $columnNames Array of column names
@param array $rows        Array of rows
@param int   $writer      Output writer
550322
protected function table(array $columnNames, array $rows, int $writer = Output::STANDARD): void
	{
		(new Table($this->output))->draw($columnNames, $rows, $writer);
	}
909385
private function importTable(string $tableName, array $columns, array $items)
    {
        if (empty($tableName) || empty($columns) || empty($items)) {
            throw new \RuntimeException(
                'Invalid import data',
                1535487373
            );
        }

        $this->connection->truncate($tableName);

        $columnNames = array_keys($columns);
        $columnTypes = array_values($columns);
        foreach ($items as $item) {
            $this->connection->insert(
                $tableName,
                array_combine($columnNames, $item),
                $columns
            );
        }
    }
366012
public static function createFilledMatrix($value, $rows, $columns = null)
    {
        if ($columns === null) {
            $columns = $rows;
        }

        $rows = Matrix::validateRow($rows);
        $columns = Matrix::validateColumn($columns);

        return new Matrix(
            array_fill(
                0,
                $rows,
                array_fill(
                    0,
                    $columns,
                    $value
                )
            )
        );
    }
1181453
protected function drawTable(string $heading, array $headers, array $rows): void
	{
		if(!empty($rows))
		{
			$this->output->write(PHP_EOL);

			$this->output->writeLn('<yellow>' . $heading . '</yellow>');

			$this->output->write(PHP_EOL);

			$table = new Table($this->output);

			$headers = array_map(function($value) { return '<green>' . $value . '</green>'; }, $headers);

			$table->draw($headers, $rows);
		}
	}
1101446
protected function table($headers, $rows)
    {
        if($this->console instanceof Command) {
            $this->console->table($headers, $rows);
        }
    }
484830
public function start_sheet($columns) {
        echo "<table border=1 cellspacing=0 cellpadding=3>";
        echo \html_writer::start_tag('tr');
        foreach ($columns as $k => $v) {
            echo \html_writer::tag('th', $v);
        }
        echo \html_writer::end_tag('tr');
    }
183213
public function insertBatchFiles(string $tableName, $fileNames, array $columns = [], string $format = 'CSV')
    {
        if (is_string($fileNames)) {
            $fileNames = [$fileNames];
        }
        if ($this->getCountPendingQueue() > 0) {
            throw new QueryException('Queue must be empty, before insertBatch, need executeAsync');
        }

        if (! in_array($format, self::SUPPORTED_FORMATS, true)) {
            throw new QueryException('Format not support in insertBatchFiles');
        }

        $result = [];

        foreach ($fileNames as $fileName) {
            if (! is_file($fileName) || ! is_readable($fileName)) {
                throw  new QueryException('Cant read file: ' . $fileName . ' ' . (is_file($fileName) ? '' : ' is not file'));
            }

            if (empty($columns)) {
                $sql = 'INSERT INTO ' . $tableName . ' FORMAT ' . $format;
            } else {
                $sql = 'INSERT INTO ' . $tableName . ' ( ' . implode(',', $columns) . ' ) FORMAT ' . $format;
            }
            $result[$fileName] = $this->transport()->writeAsyncCSV($sql, $fileName);
        }

        // exec
        $this->executeAsync();

        // fetch resutl
        foreach ($fileNames as $fileName) {
            if (! $result[$fileName]->isError()) {
                continue;
            }

            $result[$fileName]->error();
        }

        return $result;
    }
1007197
public function writeTable(WriterInterface $writer)
    {
        if (!$this->isExternal()) {
            $this->getColumns()->write($writer);
            $this->getIndices()->write($writer);
            $this->getForeignKeys()->write($writer);

            return self::WRITE_OK;
        }

        return self::WRITE_EXTERNAL;
    }
370790
public function columns($columnNames) : ForeignKeyReferencedColumnsDefiner
    {
        return new ForeignKeyReferencedColumnsDefiner(
                $this->callback,
                is_array($columnNames) ? $columnNames : [$columnNames]
        );
    }
482497
public void write(Writer out)
         throws IOException
    {
        writeHtmlHead(out);
        
        out.write("<frameset "+border);
        
        if(colSpec!=null)
            out.write(" cols=\""+colSpec+"\"");
        if(rowSpec!=null)
            out.write(" rows=\""+rowSpec+"\"");
        out.write(">");

        for(int r=0;r<rows;r++)
            for(int c=0;c<cols;c++)
                frames[c][r].write(out);

        out.write("<noframes>");
        writeElements(out);
        out.write("</noframes>");

        out.write("</frameset>");
        out.write("</html>");
    }
440008
public function updateTableColumns($writerId, $tableId, array $columns)
    {
        $allowedConfigurationOptions = ['name', 'title', 'type', 'reference', 'schemaReference', 'format', 'dateDimension'];
        foreach ($columns as $column) {
            if (!isset($column['name'])) {
                throw new ClientException("One of the columns is missing 'name' parameter");
            }
            foreach ($column as $k => $v) {
                if (!in_array($k, $allowedConfigurationOptions)) {
                    throw new ClientException("Option '$k' for column '$column' is not allowed, choose from: " . implode(', ', $allowedConfigurationOptions));
                }
            }
        }

        $params = [
            'writerId' => $writerId,
            'tableId' => $tableId,
            'columns' => $columns
        ];
        return $this->getCommand('UpdateTableColumns', $params)->execute();
    }
250810
protected function renderTable($data, $cellPadding, $columnsWidths) {
		$tableRows = [];
		
		foreach ($data as $row) {
			$row      = array_values($row);
			$tableCol = '|';
			
			$columnsNumber = count($columnsWidths);
			
			for ($colNm = 0; $colNm < $columnsNumber; ++ $colNm) {
				$colWidth = $columnsWidths[$colNm];
				$col      = isset($row[$colNm]) ? $row[$colNm] : '';
				$len      = $this->strlen($col);
				
				if ($colWidth > $len) {
					$col .= str_repeat(' ', $colWidth - $len);
				}
				
				$paddings  = str_repeat(' ', $cellPadding);
				$tableCol .= $paddings . $col . $paddings . '|';
			}
			
			$tableRows[] = $tableCol;
		}
		
		$delimLine = '+';
		
		foreach ($columnsWidths as $width) {
			$delimLine .= str_repeat('-', $width + $cellPadding * 2) . '+';
		}
		
		$body = implode(PHP_EOL . $delimLine . PHP_EOL, $tableRows);
		
		return $delimLine . PHP_EOL . $body . PHP_EOL . $delimLine;
	}
181718
public function tableColumns($tableColumns = null)
    {
        if ($tableColumns === null)
        {
            return $this->_tableColumns;
        }
        $this->_tableColumns = $tableColumns;

        return $this;
    }
387642
public function setColumns($columns, $size = null)
    {
        if (is_null($size)) {
            $size = $this->baseSize;
        }
        $columnAttribute = $size . 'Columns';
        $this->{$columnAttribute} = $columns;
    }
669312
protected function writeRow(array $columns)
    {
        $this->getStream()->write($this->buildRow($columns));
        $this->lines++;

        return $this;
    }
930448
function drawBars(table) {
        var tableDetails = getTableDetails(table);
        var tableGrid = getTableGrid(tableDetails);
        var rows = getRowBlocks(tableGrid);
        var cols = getColumnBlocks(tableGrid);

        var tablePosition = editor.dom.getPos(table);
        var rowPositions = rows.length > 0 ? findPositions(getTopEdge, getBottomEdge, rows) : [];
        var colPositions = cols.length > 0 ? findPositions(getInnerEdge, getOuterEdge, cols) : [];

        drawRows(rowPositions, table.offsetWidth, tablePosition);
        drawCols(colPositions, table.offsetHeight, tablePosition);
      }
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;
    }