提交的内容
This commit is contained in:
0
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/AutoFilter.php
vendored
Executable file → Normal file
0
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/AutoFilter.php
vendored
Executable file → Normal file
0
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/BaseParserClass.php
vendored
Executable file → Normal file
0
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/BaseParserClass.php
vendored
Executable file → Normal file
159
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Chart.php
vendored
Executable file → Normal file
159
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Chart.php
vendored
Executable file → Normal file
@ -4,6 +4,7 @@ namespace PhpOffice\PhpSpreadsheet\Reader\Xlsx;
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError;
|
||||
use PhpOffice\PhpSpreadsheet\Chart\Axis;
|
||||
use PhpOffice\PhpSpreadsheet\Chart\AxisText;
|
||||
use PhpOffice\PhpSpreadsheet\Chart\ChartColor;
|
||||
use PhpOffice\PhpSpreadsheet\Chart\DataSeries;
|
||||
use PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues;
|
||||
@ -76,16 +77,28 @@ class Chart
|
||||
$yAxis = new Axis();
|
||||
$autoTitleDeleted = null;
|
||||
$chartNoFill = false;
|
||||
$chartBorderLines = null;
|
||||
$chartFillColor = null;
|
||||
$gradientArray = [];
|
||||
$gradientLin = null;
|
||||
$roundedCorners = false;
|
||||
$gapWidth = null;
|
||||
$useUpBars = null;
|
||||
$useDownBars = null;
|
||||
foreach ($chartElementsC as $chartElementKey => $chartElement) {
|
||||
switch ($chartElementKey) {
|
||||
case 'spPr':
|
||||
$possibleNoFill = $chartElementsC->spPr->children($this->aNamespace);
|
||||
if (isset($possibleNoFill->noFill)) {
|
||||
$children = $chartElementsC->spPr->children($this->aNamespace);
|
||||
if (isset($children->noFill)) {
|
||||
$chartNoFill = true;
|
||||
}
|
||||
if (isset($children->solidFill)) {
|
||||
$chartFillColor = $this->readColor($children->solidFill);
|
||||
}
|
||||
if (isset($children->ln)) {
|
||||
$chartBorderLines = new GridLines();
|
||||
$this->readLineStyle($chartElementsC, $chartBorderLines);
|
||||
}
|
||||
|
||||
break;
|
||||
case 'roundedCorners':
|
||||
@ -157,6 +170,9 @@ class Chart
|
||||
$axisColorArray = $this->readColor($sppr->solidFill);
|
||||
$xAxis->setFillParameters($axisColorArray['value'], $axisColorArray['alpha'], $axisColorArray['type']);
|
||||
}
|
||||
if (isset($chartDetail->spPr->ln->noFill)) {
|
||||
$xAxis->setNoFill(true);
|
||||
}
|
||||
}
|
||||
if (isset($chartDetail->majorGridlines)) {
|
||||
$majorGridlines = new GridLines();
|
||||
@ -227,6 +243,9 @@ class Chart
|
||||
$axisColorArray = $this->readColor($sppr->solidFill);
|
||||
$whichAxis->setFillParameters($axisColorArray['value'], $axisColorArray['alpha'], $axisColorArray['type']);
|
||||
}
|
||||
if (isset($sppr->ln->noFill)) {
|
||||
$whichAxis->setNoFill(true);
|
||||
}
|
||||
}
|
||||
if ($whichAxis !== null && isset($chartDetail->majorGridlines)) {
|
||||
$majorGridlines = new GridLines();
|
||||
@ -316,6 +335,15 @@ class Chart
|
||||
break;
|
||||
case 'stockChart':
|
||||
$plotSeries[] = $this->chartDataSeries($chartDetail, $chartDetailKey);
|
||||
if (isset($chartDetail->upDownBars->gapWidth)) {
|
||||
$gapWidth = self::getAttribute($chartDetail->upDownBars->gapWidth, 'val', 'integer');
|
||||
}
|
||||
if (isset($chartDetail->upDownBars->upBars)) {
|
||||
$useUpBars = true;
|
||||
}
|
||||
if (isset($chartDetail->upDownBars->downBars)) {
|
||||
$useDownBars = true;
|
||||
}
|
||||
$plotAttributes = $this->readChartAttributes($chartDetail);
|
||||
|
||||
break;
|
||||
@ -332,6 +360,15 @@ class Chart
|
||||
if (!empty($gradientArray)) {
|
||||
$plotArea->setGradientFillProperties($gradientArray, $gradientLin);
|
||||
}
|
||||
if (is_int($gapWidth)) {
|
||||
$plotArea->setGapWidth($gapWidth);
|
||||
}
|
||||
if ($useUpBars === true) {
|
||||
$plotArea->setUseUpBars(true);
|
||||
}
|
||||
if ($useDownBars === true) {
|
||||
$plotArea->setUseDownBars(true);
|
||||
}
|
||||
|
||||
break;
|
||||
case 'plotVisOnly':
|
||||
@ -350,6 +387,10 @@ class Chart
|
||||
$legendPos = 'r';
|
||||
$legendLayout = null;
|
||||
$legendOverlay = false;
|
||||
$legendBorderLines = null;
|
||||
$legendFillColor = null;
|
||||
$legendText = null;
|
||||
$addLegendText = false;
|
||||
foreach ($chartDetails as $chartDetailKey => $chartDetail) {
|
||||
$chartDetail = Xlsx::testSimpleXml($chartDetail);
|
||||
switch ($chartDetailKey) {
|
||||
@ -364,10 +405,45 @@ class Chart
|
||||
case 'layout':
|
||||
$legendLayout = $this->chartLayoutDetails($chartDetail);
|
||||
|
||||
break;
|
||||
case 'spPr':
|
||||
$children = $chartDetails->spPr->children($this->aNamespace);
|
||||
if (isset($children->solidFill)) {
|
||||
$legendFillColor = $this->readColor($children->solidFill);
|
||||
}
|
||||
if (isset($children->ln)) {
|
||||
$legendBorderLines = new GridLines();
|
||||
$this->readLineStyle($chartDetails, $legendBorderLines);
|
||||
}
|
||||
|
||||
break;
|
||||
case 'txPr':
|
||||
$children = $chartDetails->txPr->children($this->aNamespace);
|
||||
$addLegendText = false;
|
||||
$legendText = new AxisText();
|
||||
if (isset($children->p->pPr->defRPr->solidFill)) {
|
||||
$colorArray = $this->readColor($children->p->pPr->defRPr->solidFill);
|
||||
$legendText->getFillColorObject()->setColorPropertiesArray($colorArray);
|
||||
$addLegendText = true;
|
||||
}
|
||||
if (isset($children->p->pPr->defRPr->effectLst)) {
|
||||
$this->readEffects($children->p->pPr->defRPr, $legendText, false);
|
||||
$addLegendText = true;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
$legend = new Legend("$legendPos", $legendLayout, (bool) $legendOverlay);
|
||||
if ($legendFillColor !== null) {
|
||||
$legend->getFillColor()->setColorPropertiesArray($legendFillColor);
|
||||
}
|
||||
if ($legendBorderLines !== null) {
|
||||
$legend->setBorderLines($legendBorderLines);
|
||||
}
|
||||
if ($addLegendText) {
|
||||
$legend->setLegendText($legendText);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
@ -378,6 +454,12 @@ class Chart
|
||||
if ($chartNoFill) {
|
||||
$chart->setNoFill(true);
|
||||
}
|
||||
if ($chartFillColor !== null) {
|
||||
$chart->getFillColor()->setColorPropertiesArray($chartFillColor);
|
||||
}
|
||||
if ($chartBorderLines !== null) {
|
||||
$chart->setBorderLines($chartBorderLines);
|
||||
}
|
||||
$chart->setRoundedCorners($roundedCorners);
|
||||
if (is_bool($autoTitleDeleted)) {
|
||||
$chart->setAutoTitleDeleted($autoTitleDeleted);
|
||||
@ -1082,6 +1164,37 @@ class Chart
|
||||
return $value;
|
||||
}
|
||||
|
||||
private function parseFont(SimpleXMLElement $titleDetailPart): ?Font
|
||||
{
|
||||
if (!isset($titleDetailPart->pPr->defRPr)) {
|
||||
return null;
|
||||
}
|
||||
$fontArray = [];
|
||||
$fontArray['size'] = self::getAttribute($titleDetailPart->pPr->defRPr, 'sz', 'integer');
|
||||
$fontArray['bold'] = self::getAttribute($titleDetailPart->pPr->defRPr, 'b', 'boolean');
|
||||
$fontArray['italic'] = self::getAttribute($titleDetailPart->pPr->defRPr, 'i', 'boolean');
|
||||
$fontArray['underscore'] = self::getAttribute($titleDetailPart->pPr->defRPr, 'u', 'string');
|
||||
$fontArray['strikethrough'] = self::getAttribute($titleDetailPart->pPr->defRPr, 'strike', 'string');
|
||||
|
||||
if (isset($titleDetailPart->pPr->defRPr->latin)) {
|
||||
$fontArray['latin'] = self::getAttribute($titleDetailPart->pPr->defRPr->latin, 'typeface', 'string');
|
||||
}
|
||||
if (isset($titleDetailPart->pPr->defRPr->ea)) {
|
||||
$fontArray['eastAsian'] = self::getAttribute($titleDetailPart->pPr->defRPr->ea, 'typeface', 'string');
|
||||
}
|
||||
if (isset($titleDetailPart->pPr->defRPr->cs)) {
|
||||
$fontArray['complexScript'] = self::getAttribute($titleDetailPart->pPr->defRPr->cs, 'typeface', 'string');
|
||||
}
|
||||
if (isset($titleDetailPart->pPr->defRPr->solidFill)) {
|
||||
$fontArray['chartColor'] = new ChartColor($this->readColor($titleDetailPart->pPr->defRPr->solidFill));
|
||||
}
|
||||
$font = new Font();
|
||||
$font->setSize(null, true);
|
||||
$font->applyFromArray($fontArray);
|
||||
|
||||
return $font;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ?SimpleXMLElement $chartDetail
|
||||
*/
|
||||
@ -1128,8 +1241,13 @@ class Chart
|
||||
}
|
||||
if (isset($chartDetail->dLbls->txPr)) {
|
||||
$txpr = $chartDetail->dLbls->txPr->children($this->aNamespace);
|
||||
if (isset($txpr->p->pPr->defRPr->solidFill)) {
|
||||
$plotAttributes['labelFontColor'] = new ChartColor($this->readColor($txpr->p->pPr->defRPr->solidFill));
|
||||
if (isset($txpr->p)) {
|
||||
$plotAttributes['labelFont'] = $this->parseFont($txpr->p);
|
||||
if (isset($txpr->p->pPr->defRPr->effectLst)) {
|
||||
$labelEffects = new GridLines();
|
||||
$this->readEffects($txpr->p->pPr->defRPr, $labelEffects, false);
|
||||
$plotAttributes['labelEffects'] = $labelEffects;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1176,13 +1294,19 @@ class Chart
|
||||
}
|
||||
}
|
||||
|
||||
private function readEffects(SimpleXMLElement $chartDetail, ?ChartProperties $chartObject): void
|
||||
private function readEffects(SimpleXMLElement $chartDetail, ?ChartProperties $chartObject, bool $getSppr = true): void
|
||||
{
|
||||
if (!isset($chartObject, $chartDetail->spPr)) {
|
||||
if (!isset($chartObject)) {
|
||||
return;
|
||||
}
|
||||
$sppr = $chartDetail->spPr->children($this->aNamespace);
|
||||
|
||||
if ($getSppr) {
|
||||
if (!isset($chartDetail->spPr)) {
|
||||
return;
|
||||
}
|
||||
$sppr = $chartDetail->spPr->children($this->aNamespace);
|
||||
} else {
|
||||
$sppr = $chartDetail;
|
||||
}
|
||||
if (isset($sppr->effectLst->glow)) {
|
||||
$axisGlowSize = (float) self::getAttribute($sppr->effectLst->glow, 'rad', 'integer') / ChartProperties::POINTS_WIDTH_MULTIPLIER;
|
||||
if ($axisGlowSize != 0.0) {
|
||||
@ -1412,13 +1536,30 @@ class Chart
|
||||
}
|
||||
if (isset($chartDetail->txPr)) {
|
||||
$children = $chartDetail->txPr->children($this->aNamespace);
|
||||
$addAxisText = false;
|
||||
$axisText = new AxisText();
|
||||
if (isset($children->bodyPr)) {
|
||||
/** @var string */
|
||||
$textRotation = self::getAttribute($children->bodyPr, 'rot', 'string');
|
||||
if (is_numeric($textRotation)) {
|
||||
$whichAxis->setAxisOption('textRotation', (string) ChartProperties::xmlToAngle($textRotation));
|
||||
$axisText->setRotation((int) ChartProperties::xmlToAngle($textRotation));
|
||||
$addAxisText = true;
|
||||
}
|
||||
}
|
||||
if (isset($children->p->pPr->defRPr)) {
|
||||
$font = $this->parseFont($children->p);
|
||||
if ($font !== null) {
|
||||
$axisText->setFont($font);
|
||||
$addAxisText = true;
|
||||
}
|
||||
}
|
||||
if (isset($children->p->pPr->defRPr->effectLst)) {
|
||||
$this->readEffects($children->p->pPr->defRPr, $axisText, false);
|
||||
$addAxisText = true;
|
||||
}
|
||||
if ($addAxisText) {
|
||||
$whichAxis->setAxisText($axisText);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
0
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/ColumnAndRowAttributes.php
vendored
Executable file → Normal file
0
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/ColumnAndRowAttributes.php
vendored
Executable file → Normal file
0
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/ConditionalStyles.php
vendored
Executable file → Normal file
0
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/ConditionalStyles.php
vendored
Executable file → Normal file
12
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/DataValidations.php
vendored
Executable file → Normal file
12
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/DataValidations.php
vendored
Executable file → Normal file
@ -22,6 +22,18 @@ class DataValidations
|
||||
|
||||
public function load(): void
|
||||
{
|
||||
foreach ($this->worksheetXml->dataValidations->dataValidation as $dataValidation) {
|
||||
// Uppercase coordinate
|
||||
$range = strtoupper((string) $dataValidation['sqref']);
|
||||
$rangeSet = explode(' ', $range);
|
||||
foreach ($rangeSet as $range) {
|
||||
if (preg_match('/^[A-Z]{1,3}\\d{1,7}/', $range, $matches) === 1) {
|
||||
// Ensure left/top row of range exists, thereby
|
||||
// adjusting high row/column.
|
||||
$this->worksheet->getCell($matches[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach ($this->worksheetXml->dataValidations->dataValidation as $dataValidation) {
|
||||
// Uppercase coordinate
|
||||
$range = strtoupper((string) $dataValidation['sqref']);
|
||||
|
||||
0
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Hyperlinks.php
vendored
Executable file → Normal file
0
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Hyperlinks.php
vendored
Executable file → Normal file
0
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Namespaces.php
vendored
Executable file → Normal file
0
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Namespaces.php
vendored
Executable file → Normal file
0
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/PageSetup.php
vendored
Executable file → Normal file
0
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/PageSetup.php
vendored
Executable file → Normal file
8
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Properties.php
vendored
Executable file → Normal file
8
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Properties.php
vendored
Executable file → Normal file
@ -4,7 +4,6 @@ namespace PhpOffice\PhpSpreadsheet\Reader\Xlsx;
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Document\Properties as DocumentProperties;
|
||||
use PhpOffice\PhpSpreadsheet\Reader\Security\XmlScanner;
|
||||
use PhpOffice\PhpSpreadsheet\Settings;
|
||||
use SimpleXMLElement;
|
||||
|
||||
class Properties
|
||||
@ -33,9 +32,7 @@ class Properties
|
||||
{
|
||||
// okay to omit namespace because everything will be processed by xpath
|
||||
$obj = simplexml_load_string(
|
||||
$this->securityScanner->scan($propertyData),
|
||||
'SimpleXMLElement',
|
||||
Settings::getLibXmlLoaderOptions()
|
||||
$this->securityScanner->scan($propertyData)
|
||||
);
|
||||
|
||||
return self::nullOrSimple($obj);
|
||||
@ -73,6 +70,9 @@ class Properties
|
||||
if (isset($xmlCore->Manager)) {
|
||||
$this->docProps->setManager((string) $xmlCore->Manager);
|
||||
}
|
||||
if (isset($xmlCore->HyperlinkBase)) {
|
||||
$this->docProps->setHyperlinkBase((string) $xmlCore->HyperlinkBase);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
26
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/SharedFormula.php
vendored
Normal file
26
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/SharedFormula.php
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace PhpOffice\PhpSpreadsheet\Reader\Xlsx;
|
||||
|
||||
class SharedFormula
|
||||
{
|
||||
private string $master;
|
||||
|
||||
private string $formula;
|
||||
|
||||
public function __construct(string $master, string $formula)
|
||||
{
|
||||
$this->master = $master;
|
||||
$this->formula = $formula;
|
||||
}
|
||||
|
||||
public function master(): string
|
||||
{
|
||||
return $this->master;
|
||||
}
|
||||
|
||||
public function formula(): string
|
||||
{
|
||||
return $this->formula;
|
||||
}
|
||||
}
|
||||
0
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/SheetViewOptions.php
vendored
Executable file → Normal file
0
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/SheetViewOptions.php
vendored
Executable file → Normal file
0
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/SheetViews.php
vendored
Executable file → Normal file
0
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/SheetViews.php
vendored
Executable file → Normal file
16
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Styles.php
vendored
Executable file → Normal file
16
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Styles.php
vendored
Executable file → Normal file
@ -136,6 +136,10 @@ class Styles extends BaseParserClass
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isset($fontStyleXml->scheme)) {
|
||||
$attr = $this->getStyleAttributes($fontStyleXml->scheme);
|
||||
$fontStyle->setScheme((string) $attr['val']);
|
||||
}
|
||||
}
|
||||
|
||||
private function readNumberFormat(NumberFormat $numfmtStyle, SimpleXMLElement $numfmtStyleXml): void
|
||||
@ -253,10 +257,14 @@ class Styles extends BaseParserClass
|
||||
|
||||
public function readAlignmentStyle(Alignment $alignment, SimpleXMLElement $alignmentXml): void
|
||||
{
|
||||
$horizontal = $this->getAttribute($alignmentXml, 'horizontal');
|
||||
$alignment->setHorizontal($horizontal);
|
||||
$vertical = $this->getAttribute($alignmentXml, 'vertical');
|
||||
$alignment->setVertical((string) $vertical);
|
||||
$horizontal = (string) $this->getAttribute($alignmentXml, 'horizontal');
|
||||
if ($horizontal !== '') {
|
||||
$alignment->setHorizontal($horizontal);
|
||||
}
|
||||
$vertical = (string) $this->getAttribute($alignmentXml, 'vertical');
|
||||
if ($vertical !== '') {
|
||||
$alignment->setVertical($vertical);
|
||||
}
|
||||
|
||||
$textRotation = (int) $this->getAttribute($alignmentXml, 'textRotation');
|
||||
if ($textRotation > 90) {
|
||||
|
||||
0
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/TableReader.php
vendored
Executable file → Normal file
0
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/TableReader.php
vendored
Executable file → Normal file
0
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Theme.php
vendored
Executable file → Normal file
0
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Theme.php
vendored
Executable file → Normal file
0
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/WorkbookView.php
vendored
Executable file → Normal file
0
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/WorkbookView.php
vendored
Executable file → Normal file
Reference in New Issue
Block a user