-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4006 from oleibman/issue4004
RTL Text Alignment in Xlsx Comment
- Loading branch information
Showing
6 changed files
with
68 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
tests/PhpSpreadsheetTests/Writer/Xlsx/CommentAlignmentTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PhpOffice\PhpSpreadsheetTests\Writer\Xlsx; | ||
|
||
use PhpOffice\PhpSpreadsheet\Spreadsheet; | ||
use PhpOffice\PhpSpreadsheet\Style\Alignment; | ||
use PhpOffice\PhpSpreadsheetTests\Functional\AbstractFunctional; | ||
|
||
class CommentAlignmentTest extends AbstractFunctional | ||
{ | ||
public function testIssue4004(): void | ||
{ | ||
$type = 'Xlsx'; | ||
$spreadsheet = new Spreadsheet(); | ||
$sheet = $spreadsheet->getActiveSheet(); | ||
$sheet->getComment('A3')->getText()->createText('Comment'); | ||
$sheet->getComment('A4')->getText()->createText('שלום'); | ||
$sheet->getComment('A4')->setAlignment(Alignment::HORIZONTAL_RIGHT); | ||
|
||
$reloadedSpreadsheet = $this->writeAndReload($spreadsheet, $type); | ||
$spreadsheet->disconnectWorksheets(); | ||
|
||
self::assertCount(1, $reloadedSpreadsheet->getAllSheets()); | ||
|
||
$rsheet = $reloadedSpreadsheet->getActiveSheet(); | ||
$comment1 = $rsheet->getComment('A3'); | ||
self::assertSame('Comment', $comment1->getText()->getPlainText()); | ||
self::assertSame('general', $comment1->getAlignment()); | ||
$comment2 = $rsheet->getComment('A4'); | ||
self::assertSame('שלום', $comment2->getText()->getPlainText()); | ||
self::assertSame('Right', $comment2->getAlignment()); | ||
|
||
$reloadedSpreadsheet->disconnectWorksheets(); | ||
} | ||
} |