mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-09-02 05:27:44 +00:00
0c64e18cbd
Continuing the work of PR #4810. Ods Reader changes still to come - Default border, alignment, protection - Font - subscript - superscript - Borders (up next) - Style applied to entire row - Style applied to entire column - Parent styles? Ods Writer changes still to come - Default border, alignment, protections - Style applied to entire row - Style applied to entire column - Parent styles?
59 lines
2.9 KiB
PHP
59 lines
2.9 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace PhpOffice\PhpSpreadsheetTests\Writer\Ods;
|
|
|
|
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
|
use PhpOffice\PhpSpreadsheet\Style\Alignment;
|
|
use PhpOffice\PhpSpreadsheet\Writer\Ods;
|
|
use PhpOffice\PhpSpreadsheet\Writer\Ods\Content;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class ReadOrderTest extends TestCase
|
|
{
|
|
public function testReadOrder(): void
|
|
{
|
|
$spreadsheet = new Spreadsheet();
|
|
$sheet = $spreadsheet->getActiveSheet();
|
|
$sheet->setCellValue('A1', '1-' . 'منصور حسين الناصر');
|
|
$sheet->setCellValue('A2', '1-' . 'منصور حسين الناصر');
|
|
$sheet->setCellValue('A3', '1-' . 'منصور حسين الناصر');
|
|
$sheet->getStyle('A1')
|
|
->getAlignment()->setReadOrder(Alignment::READORDER_RTL);
|
|
$sheet->getStyle('A2')
|
|
->getAlignment()->setReadOrder(Alignment::READORDER_LTR);
|
|
$sheet->getStyle('A2')->getFont()->setName('Arial');
|
|
$sheet->getStyle('A3')->getFont()->setName('Times New Roman');
|
|
$content = new Content(new Ods($spreadsheet));
|
|
$xml = $content->write();
|
|
self::assertStringContainsString(
|
|
'<style:style style:name="ce1" style:family="table-cell" style:parent-style-name="Default">'
|
|
. '<style:table-cell-properties style:vertical-align="bottom" style:rotation-angle="0" style:rotation-align="none" fo:background-color="transparent"/>'
|
|
. '<style:paragraph-properties style:writing-mode="rl-tb"/>'
|
|
. '<style:text-properties fo:color="#000000" fo:font-family="Calibri" fo:font-size="11pt"/>'
|
|
. '</style:style>',
|
|
$xml,
|
|
'explicit rtl direction in paragraph properties'
|
|
);
|
|
self::assertStringContainsString(
|
|
'<style:style style:name="ce3" style:family="table-cell" style:parent-style-name="Default">'
|
|
. '<style:table-cell-properties style:vertical-align="bottom" style:rotation-angle="0" style:rotation-align="none" fo:background-color="transparent"/>'
|
|
. '<style:paragraph-properties style:writing-mode="lr-tb"/>'
|
|
. '<style:text-properties fo:color="#000000" fo:font-family="Arial" fo:font-size="11pt"/>'
|
|
. '</style:style>',
|
|
$xml,
|
|
'explicit ltr direction in paragraph properties'
|
|
);
|
|
self::assertStringContainsString(
|
|
'<style:style style:name="ce4" style:family="table-cell" style:parent-style-name="Default">'
|
|
. '<style:table-cell-properties style:vertical-align="bottom" style:rotation-angle="0" style:rotation-align="none" fo:background-color="transparent"/>'
|
|
. '<style:text-properties fo:color="#000000" fo:font-family="Times New Roman" fo:font-size="11pt"/>'
|
|
. '</style:style>',
|
|
$xml,
|
|
'no paragraph properties'
|
|
);
|
|
$spreadsheet->disconnectWorksheets();
|
|
}
|
|
}
|