提交的内容

This commit is contained in:
2025-05-12 15:45:02 +08:00
parent 629c4750da
commit b48c692775
3043 changed files with 34732 additions and 60810 deletions

49
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Font.php vendored Executable file → Normal file
View File

@ -107,6 +107,9 @@ class Font extends Supervisor
*/
public $colorIndex;
/** @var string */
protected $scheme = '';
/**
* Create a new Font.
*
@ -231,6 +234,12 @@ class Font extends Supervisor
if (isset($styleArray['size'])) {
$this->setSize($styleArray['size']);
}
if (isset($styleArray['chartColor'])) {
$this->chartColor = $styleArray['chartColor'];
}
if (isset($styleArray['scheme'])) {
$this->setScheme($styleArray['scheme']);
}
}
return $this;
@ -278,13 +287,11 @@ class Font extends Supervisor
}
/**
* Set Name.
* Set Name and turn off Scheme.
*
* @param string $fontname
*
* @return $this
*/
public function setName($fontname)
public function setName($fontname): self
{
if ($fontname == '') {
$fontname = 'Calibri';
@ -296,7 +303,7 @@ class Font extends Supervisor
$this->name = $fontname;
}
return $this;
return $this->setScheme('');
}
public function setLatin(string $fontname): self
@ -634,6 +641,13 @@ class Font extends Supervisor
return $this;
}
public function setChartColorFromObject(?ChartColor $chartColor): self
{
$this->chartColor = $chartColor;
return $this;
}
/**
* Get Underline.
*
@ -774,6 +788,7 @@ class Font extends Supervisor
$this->underline .
($this->strikethrough ? 't' : 'f') .
$this->color->getHashCode() .
$this->scheme .
implode(
'*',
[
@ -802,6 +817,7 @@ class Font extends Supervisor
$this->exportArray2($exportedArray, 'italic', $this->getItalic());
$this->exportArray2($exportedArray, 'latin', $this->getLatin());
$this->exportArray2($exportedArray, 'name', $this->getName());
$this->exportArray2($exportedArray, 'scheme', $this->getScheme());
$this->exportArray2($exportedArray, 'size', $this->getSize());
$this->exportArray2($exportedArray, 'strikethrough', $this->getStrikethrough());
$this->exportArray2($exportedArray, 'strikeType', $this->getStrikeType());
@ -812,4 +828,27 @@ class Font extends Supervisor
return $exportedArray;
}
public function getScheme(): string
{
if ($this->isSupervisor) {
return $this->getSharedComponent()->getScheme();
}
return $this->scheme;
}
public function setScheme(string $scheme): self
{
if ($scheme === '' || $scheme === 'major' || $scheme === 'minor') {
if ($this->isSupervisor) {
$styleArray = $this->getStyleArray(['scheme' => $scheme]);
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
} else {
$this->scheme = $scheme;
}
}
return $this;
}
}