init
This commit is contained in:
commit
72a26edcff
22092 changed files with 2101903 additions and 0 deletions
37
lib/PhpSpreadsheet/Reader/Xls/Style/Border.php
Normal file
37
lib/PhpSpreadsheet/Reader/Xls/Style/Border.php
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
namespace PhpOffice\PhpSpreadsheet\Reader\Xls\Style;
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Style\Border as StyleBorder;
|
||||
|
||||
class Border
|
||||
{
|
||||
/**
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected static array $borderStyleMap = [
|
||||
0x00 => StyleBorder::BORDER_NONE,
|
||||
0x01 => StyleBorder::BORDER_THIN,
|
||||
0x02 => StyleBorder::BORDER_MEDIUM,
|
||||
0x03 => StyleBorder::BORDER_DASHED,
|
||||
0x04 => StyleBorder::BORDER_DOTTED,
|
||||
0x05 => StyleBorder::BORDER_THICK,
|
||||
0x06 => StyleBorder::BORDER_DOUBLE,
|
||||
0x07 => StyleBorder::BORDER_HAIR,
|
||||
0x08 => StyleBorder::BORDER_MEDIUMDASHED,
|
||||
0x09 => StyleBorder::BORDER_DASHDOT,
|
||||
0x0A => StyleBorder::BORDER_MEDIUMDASHDOT,
|
||||
0x0B => StyleBorder::BORDER_DASHDOTDOT,
|
||||
0x0C => StyleBorder::BORDER_MEDIUMDASHDOTDOT,
|
||||
0x0D => StyleBorder::BORDER_SLANTDASHDOT,
|
||||
];
|
||||
|
||||
public static function lookup(int $index): string
|
||||
{
|
||||
if (isset(self::$borderStyleMap[$index])) {
|
||||
return self::$borderStyleMap[$index];
|
||||
}
|
||||
|
||||
return StyleBorder::BORDER_NONE;
|
||||
}
|
||||
}
|
||||
50
lib/PhpSpreadsheet/Reader/Xls/Style/CellAlignment.php
Normal file
50
lib/PhpSpreadsheet/Reader/Xls/Style/CellAlignment.php
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
|
||||
namespace PhpOffice\PhpSpreadsheet\Reader\Xls\Style;
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Style\Alignment;
|
||||
|
||||
class CellAlignment
|
||||
{
|
||||
/**
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected static array $horizontalAlignmentMap = [
|
||||
0 => Alignment::HORIZONTAL_GENERAL,
|
||||
1 => Alignment::HORIZONTAL_LEFT,
|
||||
2 => Alignment::HORIZONTAL_CENTER,
|
||||
3 => Alignment::HORIZONTAL_RIGHT,
|
||||
4 => Alignment::HORIZONTAL_FILL,
|
||||
5 => Alignment::HORIZONTAL_JUSTIFY,
|
||||
6 => Alignment::HORIZONTAL_CENTER_CONTINUOUS,
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected static array $verticalAlignmentMap = [
|
||||
0 => Alignment::VERTICAL_TOP,
|
||||
1 => Alignment::VERTICAL_CENTER,
|
||||
2 => Alignment::VERTICAL_BOTTOM,
|
||||
3 => Alignment::VERTICAL_JUSTIFY,
|
||||
];
|
||||
|
||||
public static function horizontal(Alignment $alignment, int $horizontal): void
|
||||
{
|
||||
if (array_key_exists($horizontal, self::$horizontalAlignmentMap)) {
|
||||
$alignment->setHorizontal(self::$horizontalAlignmentMap[$horizontal]);
|
||||
}
|
||||
}
|
||||
|
||||
public static function vertical(Alignment $alignment, int $vertical): void
|
||||
{
|
||||
if (array_key_exists($vertical, self::$verticalAlignmentMap)) {
|
||||
$alignment->setVertical(self::$verticalAlignmentMap[$vertical]);
|
||||
}
|
||||
}
|
||||
|
||||
public static function wrap(Alignment $alignment, int $wrap): void
|
||||
{
|
||||
$alignment->setWrapText((bool) $wrap);
|
||||
}
|
||||
}
|
||||
39
lib/PhpSpreadsheet/Reader/Xls/Style/CellFont.php
Normal file
39
lib/PhpSpreadsheet/Reader/Xls/Style/CellFont.php
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
namespace PhpOffice\PhpSpreadsheet\Reader\Xls\Style;
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Style\Font;
|
||||
|
||||
class CellFont
|
||||
{
|
||||
public static function escapement(Font $font, int $escapement): void
|
||||
{
|
||||
switch ($escapement) {
|
||||
case 0x0001:
|
||||
$font->setSuperscript(true);
|
||||
|
||||
break;
|
||||
case 0x0002:
|
||||
$font->setSubscript(true);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected static array $underlineMap = [
|
||||
0x01 => Font::UNDERLINE_SINGLE,
|
||||
0x02 => Font::UNDERLINE_DOUBLE,
|
||||
0x21 => Font::UNDERLINE_SINGLEACCOUNTING,
|
||||
0x22 => Font::UNDERLINE_DOUBLEACCOUNTING,
|
||||
];
|
||||
|
||||
public static function underline(Font $font, int $underline): void
|
||||
{
|
||||
if (array_key_exists($underline, self::$underlineMap)) {
|
||||
$font->setUnderline(self::$underlineMap[$underline]);
|
||||
}
|
||||
}
|
||||
}
|
||||
46
lib/PhpSpreadsheet/Reader/Xls/Style/FillPattern.php
Normal file
46
lib/PhpSpreadsheet/Reader/Xls/Style/FillPattern.php
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
|
||||
namespace PhpOffice\PhpSpreadsheet\Reader\Xls\Style;
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Style\Fill;
|
||||
|
||||
class FillPattern
|
||||
{
|
||||
/**
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected static array $fillPatternMap = [
|
||||
0x00 => Fill::FILL_NONE,
|
||||
0x01 => Fill::FILL_SOLID,
|
||||
0x02 => Fill::FILL_PATTERN_MEDIUMGRAY,
|
||||
0x03 => Fill::FILL_PATTERN_DARKGRAY,
|
||||
0x04 => Fill::FILL_PATTERN_LIGHTGRAY,
|
||||
0x05 => Fill::FILL_PATTERN_DARKHORIZONTAL,
|
||||
0x06 => Fill::FILL_PATTERN_DARKVERTICAL,
|
||||
0x07 => Fill::FILL_PATTERN_DARKDOWN,
|
||||
0x08 => Fill::FILL_PATTERN_DARKUP,
|
||||
0x09 => Fill::FILL_PATTERN_DARKGRID,
|
||||
0x0A => Fill::FILL_PATTERN_DARKTRELLIS,
|
||||
0x0B => Fill::FILL_PATTERN_LIGHTHORIZONTAL,
|
||||
0x0C => Fill::FILL_PATTERN_LIGHTVERTICAL,
|
||||
0x0D => Fill::FILL_PATTERN_LIGHTDOWN,
|
||||
0x0E => Fill::FILL_PATTERN_LIGHTUP,
|
||||
0x0F => Fill::FILL_PATTERN_LIGHTGRID,
|
||||
0x10 => Fill::FILL_PATTERN_LIGHTTRELLIS,
|
||||
0x11 => Fill::FILL_PATTERN_GRAY125,
|
||||
0x12 => Fill::FILL_PATTERN_GRAY0625,
|
||||
];
|
||||
|
||||
/**
|
||||
* Get fill pattern from index
|
||||
* OpenOffice documentation: 2.5.12.
|
||||
*/
|
||||
public static function lookup(int $index): string
|
||||
{
|
||||
if (isset(self::$fillPatternMap[$index])) {
|
||||
return self::$fillPatternMap[$index];
|
||||
}
|
||||
|
||||
return Fill::FILL_NONE;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue