17 $this->worksheet = $workSheet;
21 public function load(array $unparsedLoadedData)
23 if (!$this->worksheetXml) {
24 return $unparsedLoadedData;
27 $this->
margins($this->worksheetXml, $this->worksheet);
28 $unparsedLoadedData = $this->
pageSetup($this->worksheetXml, $this->worksheet, $unparsedLoadedData);
29 $this->
headerFooter($this->worksheetXml, $this->worksheet);
30 $this->
pageBreaks($this->worksheetXml, $this->worksheet);
32 return $unparsedLoadedData;
37 if ($xmlSheet->pageMargins) {
39 $docPageMargins->setLeft((
float) ($xmlSheet->pageMargins[
'left']));
40 $docPageMargins->setRight((
float) ($xmlSheet->pageMargins[
'right']));
41 $docPageMargins->setTop((
float) ($xmlSheet->pageMargins[
'top']));
42 $docPageMargins->setBottom((
float) ($xmlSheet->pageMargins[
'bottom']));
43 $docPageMargins->setHeader((
float) ($xmlSheet->pageMargins[
'header']));
44 $docPageMargins->setFooter((
float) ($xmlSheet->pageMargins[
'footer']));
50 if ($xmlSheet->pageSetup) {
53 if (isset($xmlSheet->pageSetup[
'orientation'])) {
54 $docPageSetup->setOrientation((
string) $xmlSheet->pageSetup[
'orientation']);
56 if (isset($xmlSheet->pageSetup[
'paperSize'])) {
57 $docPageSetup->setPaperSize((
int) ($xmlSheet->pageSetup[
'paperSize']));
59 if (isset($xmlSheet->pageSetup[
'scale'])) {
60 $docPageSetup->setScale((
int) ($xmlSheet->pageSetup[
'scale']),
false);
62 if (isset($xmlSheet->pageSetup[
'fitToHeight']) && (
int) ($xmlSheet->pageSetup[
'fitToHeight']) >= 0) {
63 $docPageSetup->setFitToHeight((
int) ($xmlSheet->pageSetup[
'fitToHeight']),
false);
65 if (isset($xmlSheet->pageSetup[
'fitToWidth']) && (
int) ($xmlSheet->pageSetup[
'fitToWidth']) >= 0) {
66 $docPageSetup->setFitToWidth((
int) ($xmlSheet->pageSetup[
'fitToWidth']),
false);
69 isset($xmlSheet->pageSetup[
'firstPageNumber'], $xmlSheet->pageSetup[
'useFirstPageNumber']) &&
70 self::boolean((
string) $xmlSheet->pageSetup[
'useFirstPageNumber'])
72 $docPageSetup->setFirstPageNumber((
int) ($xmlSheet->pageSetup[
'firstPageNumber']));
74 if (isset($xmlSheet->pageSetup[
'pageOrder'])) {
75 $docPageSetup->setPageOrder((
string) $xmlSheet->pageSetup[
'pageOrder']);
78 $relAttributes = $xmlSheet->pageSetup->attributes(
'http://schemas.openxmlformats.org/officeDocument/2006/relationships');
79 if (isset($relAttributes[
'id'])) {
80 $unparsedLoadedData[
'sheets'][$worksheet->
getCodeName()][
'pageSetupRelId'] = (string) $relAttributes[
'id'];
84 return $unparsedLoadedData;
89 if ($xmlSheet->headerFooter) {
93 isset($xmlSheet->headerFooter[
'differentOddEven']) &&
94 self::boolean((
string) $xmlSheet->headerFooter[
'differentOddEven'])
96 $docHeaderFooter->setDifferentOddEven(
true);
98 $docHeaderFooter->setDifferentOddEven(
false);
101 isset($xmlSheet->headerFooter[
'differentFirst']) &&
102 self::boolean((
string) $xmlSheet->headerFooter[
'differentFirst'])
104 $docHeaderFooter->setDifferentFirst(
true);
106 $docHeaderFooter->setDifferentFirst(
false);
109 isset($xmlSheet->headerFooter[
'scaleWithDoc']) &&
110 !self::boolean((
string) $xmlSheet->headerFooter[
'scaleWithDoc'])
112 $docHeaderFooter->setScaleWithDocument(
false);
114 $docHeaderFooter->setScaleWithDocument(
true);
117 isset($xmlSheet->headerFooter[
'alignWithMargins']) &&
118 !self::boolean((
string) $xmlSheet->headerFooter[
'alignWithMargins'])
120 $docHeaderFooter->setAlignWithMargins(
false);
122 $docHeaderFooter->setAlignWithMargins(
true);
125 $docHeaderFooter->setOddHeader((
string) $xmlSheet->headerFooter->oddHeader);
126 $docHeaderFooter->setOddFooter((
string) $xmlSheet->headerFooter->oddFooter);
127 $docHeaderFooter->setEvenHeader((
string) $xmlSheet->headerFooter->evenHeader);
128 $docHeaderFooter->setEvenFooter((
string) $xmlSheet->headerFooter->evenFooter);
129 $docHeaderFooter->setFirstHeader((
string) $xmlSheet->headerFooter->firstHeader);
130 $docHeaderFooter->setFirstFooter((
string) $xmlSheet->headerFooter->firstFooter);
136 if ($xmlSheet->rowBreaks && $xmlSheet->rowBreaks->brk) {
139 if ($xmlSheet->colBreaks && $xmlSheet->colBreaks->brk) {
146 foreach ($xmlSheet->rowBreaks->brk as $brk) {
155 foreach ($xmlSheet->colBreaks->brk as $brk) {
headerFooter(SimpleXMLElement $xmlSheet, Worksheet $worksheet)
getPageMargins()
Get page margins.
getCodeName()
Return the code name of the sheet.
getPageSetup()
Get page setup.
margins(SimpleXMLElement $xmlSheet, Worksheet $worksheet)
pageBreaks(SimpleXMLElement $xmlSheet, Worksheet $worksheet)
columnBreaks(SimpleXMLElement $xmlSheet, Worksheet $worksheet)
rowBreaks(SimpleXMLElement $xmlSheet, Worksheet $worksheet)
pageSetup(SimpleXMLElement $xmlSheet, Worksheet $worksheet, array $unparsedLoadedData)
getHeaderFooter()
Get page header/footer.
__construct(Worksheet $workSheet, ?SimpleXMLElement $worksheetXml=null)
setBreak($pCoordinate, $pBreak)
Set break on a cell.
static stringFromColumnIndex($columnIndex)
String from column index.
load(array $unparsedLoadedData)