mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-08-17 12:10:19 +00:00
98f464b41f
Fix #1104, which went stale over 6 years ago, and is now reopened. This PR addresses the alignment of the table, not alignment of text. Support is added for the following: - Html. Full support. - Mpdf. Full support, except that, when mixed LTR and RTL worksheets are output, all tables will be on the left of the page (but will be properly aligned). - Tcpdf. Full support when all worksheets being output are RTL; no support when mixed LTR and RTL worksheets are output. - Dompdf. No support.
29 lines
709 B
PHP
29 lines
709 B
PHP
<?php
|
|
|
|
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
|
|
|
require __DIR__ . '/../Header.php';
|
|
|
|
/** @var PhpOffice\PhpSpreadsheet\Helper\Sample $helper */
|
|
$spreadsheet = new Spreadsheet();
|
|
$sheet = $spreadsheet->getActiveSheet();
|
|
|
|
$sheet1 = $spreadsheet->getActiveSheet();
|
|
$sheet2 = $spreadsheet->createSheet();
|
|
$sheet3 = $spreadsheet->createSheet();
|
|
$cells = [
|
|
['a1', 'b1', 'c1'],
|
|
['a2', 'b2', 'c2'],
|
|
];
|
|
$sheet1->fromArray($cells);
|
|
$sheet1->setRightToLeft(true);
|
|
$sheet2->fromArray($cells);
|
|
$sheet3->fromArray($cells);
|
|
$sheet3->setRightToLeft(true);
|
|
|
|
$helper->log('Write to html, mpdf, tcpdf');
|
|
// Save
|
|
$helper->write($spreadsheet, __FILE__, ['Html', 'Mpdf', 'Tcpdf']);
|
|
|
|
$spreadsheet->disconnectWorksheets();
|