280 $this->paperSize = $pValue;
304 $this->orientation = $pValue;
333 if (($pValue >= 0) || $pValue ===
null) {
334 $this->scale = $pValue;
336 $this->fitToPage =
false;
339 throw new PhpSpreadsheetException(
'Scale must not be negative');
364 $this->fitToPage = $pValue;
389 $this->fitToHeight = $pValue;
391 $this->fitToPage =
true;
417 $this->fitToWidth = $pValue;
419 $this->fitToPage =
true;
432 if (is_array($this->columnsToRepeatAtLeft)) {
433 if ($this->columnsToRepeatAtLeft[0] !=
'' && $this->columnsToRepeatAtLeft[1] !=
'') {
460 $this->columnsToRepeatAtLeft = $pValue;
475 $this->columnsToRepeatAtLeft = [$pStart, $pEnd];
487 if (is_array($this->rowsToRepeatAtTop)) {
488 if ($this->rowsToRepeatAtTop[0] != 0 && $this->rowsToRepeatAtTop[1] != 0) {
515 $this->rowsToRepeatAtTop = $pValue;
530 $this->rowsToRepeatAtTop = [$pStart, $pEnd];
554 $this->horizontalCentered = $value;
578 $this->verticalCentered = $value;
598 $printAreas = explode(
',', $this->printArea);
599 if (isset($printAreas[
$index - 1])) {
600 return $printAreas[
$index - 1];
603 throw new PhpSpreadsheetException(
'Requested Print Area does not exist');
619 return $this->printArea !==
null;
621 $printAreas = explode(
',', $this->printArea);
623 return isset($printAreas[
$index - 1]);
639 $this->printArea =
null;
641 $printAreas = explode(
',', $this->printArea);
642 if (isset($printAreas[
$index - 1])) {
643 unset($printAreas[
$index - 1]);
644 $this->printArea = implode(
',', $printAreas);
673 if (strpos($value,
'!') !==
false) {
674 throw new PhpSpreadsheetException(
'Cell coordinate must not specify a worksheet.');
675 } elseif (strpos($value,
':') ===
false) {
676 throw new PhpSpreadsheetException(
'Cell coordinate must be a range of cells.');
677 } elseif (strpos($value,
'$') !==
false) {
678 throw new PhpSpreadsheetException(
'Cell coordinate must not be absolute.');
680 $value = strtoupper($value);
681 if (!$this->printArea) {
685 if ($method == self::SETPRINTRANGE_OVERWRITE) {
687 $this->printArea = $value;
689 $printAreas = explode(
',', $this->printArea);
694 throw new PhpSpreadsheetException(
'Invalid index for setting print range.');
696 $printAreas[
$index - 1] = $value;
697 $this->printArea = implode(
',', $printAreas);
699 } elseif ($method == self::SETPRINTRANGE_INSERT) {
701 $this->printArea = $this->printArea ? ($this->printArea .
',' . $value) : $value;
703 $printAreas = explode(
',', $this->printArea);
707 if (
$index > count($printAreas)) {
708 throw new PhpSpreadsheetException(
'Invalid index for setting print range.');
710 $printAreas = array_merge(array_slice($printAreas, 0,
$index), [$value], array_slice($printAreas,
$index));
711 $this->printArea = implode(
',', $printAreas);
714 throw new PhpSpreadsheetException(
'Invalid method for setting print range.');
791 self::SETPRINTRANGE_INSERT
814 $this->firstPageNumber = $value;
848 $vars = get_object_vars($this);
849 foreach ($vars as
$key => $value) {
850 if (is_object($value)) {
851 $this->
$key = clone $value;
853 $this->
$key = $value;
An exception for terminatinating execution or to throw for unit testing.
Helper class to manipulate cell coordinates.
static stringFromColumnIndex($columnIndex)
String from column index.
Paper size taken from Office Open XML Part 4 - Markup Language Reference, page 1988:.
setRowsToRepeatAtTop(array $pValue)
Set Rows to repeat at top.
const PAPERSIZE_C4_ENVELOPE
const PAPERSIZE_EXECUTIVE
const PAPERSIZE_STANDARD_PAPER_2
__construct()
Create a new PageSetup.
const ORIENTATION_LANDSCAPE
getColumnsToRepeatAtLeft()
Get Columns to repeat at left.
setPrintAreaByColumnAndRow($column1, $row1, $column2, $row2, $index=0, $method=self::SETPRINTRANGE_OVERWRITE)
Set print area.
setPageOrder(?string $pageOrder)
const PAPERSIZE_JIS_B5_TRANSVERSE_PAPER
setPaperSize($pValue)
Set Paper Size.
const PAPERSIZE_A4_TRANSVERSE_PAPER
setFitToWidth($pValue, $pUpdate=true)
Set Fit To Width.
isPrintAreaSet($index=0)
Is print area set?
resetFirstPageNumber()
Reset first page number.
const PAPERSIZE_A5_EXTRA_PAPER
const PAPERSIZE_LETTER_PLUS_PAPER
getFitToHeight()
Get Fit To Height.
const PAPERSIZE_A3_EXTRA_TRANSVERSE_PAPER
const PAPERSIZE_A4_PLUS_PAPER
const PAPERSIZE_A3_EXTRA_PAPER
const PAPERSIZE_SUPERB_SUPERB_A3_PAPER
const PAPERSIZE_ITALY_ENVELOPE
getPaperSize()
Get Paper Size.
const PAPERSIZE_B4_ENVELOPE
getRowsToRepeatAtTop()
Get Rows to repeat at top.
__clone()
Implement PHP __clone to create a deep clone, not just a shallow copy.
const PAPERSIZE_TABLOID_EXTRA_PAPER
const PAPERSIZE_STANDARD_PAPER_3
setFirstPageNumber($value)
Set first page number.
const PAPERSIZE_STATEMENT
const PAPERSIZE_INVITE_ENVELOPE
const PAPERSIZE_NO14_ENVELOPE
const PAPERSIZE_A3_TRANSVERSE_PAPER
const PAPERSIZE_NO10_ENVELOPE
const PAPERSIZE_NO11_ENVELOPE
const PAPERSIZE_US_STANDARD_FANFOLD
const PAPERSIZE_MONARCH_ENVELOPE
const PAPERSIZE_6_3_4_ENVELOPE
const PAPERSIZE_A5_TRANSVERSE_PAPER
const PAPERSIZE_SUPERA_SUPERA_A4_PAPER
const PAPERSIZE_A4_EXTRA_PAPER
addPrintArea($value, $index=-1)
Add a new print area (e.g.
const PAPERSIZE_ISO_B5_EXTRA_PAPER
const SETPRINTRANGE_OVERWRITE
setRowsToRepeatAtTopByStartAndEnd($pStart, $pEnd)
Set Rows to repeat at top by start and end.
const PAPERSIZE_DL_ENVELOPE
const PAPERSIZE_LEGAL_EXTRA_PAPER
clearPrintArea($index=0)
Clear a print area.
getFitToWidth()
Get Fit To Width.
const PAGEORDER_OVER_THEN_DOWN
const PAPERSIZE_NO9_ENVELOPE
setColumnsToRepeatAtLeft(array $pValue)
Set Columns to repeat at left.
getFitToPage()
Get Fit To Page.
const PAPERSIZE_C5_ENVELOPE
getVerticalCentered()
Get center page vertically.
const PAPERSIZE_B5_ENVELOPE
const PAPERSIZE_GERMAN_LEGAL_FANFOLD
const PAPERSIZE_C3_ENVELOPE
setPrintArea($value, $index=0, $method=self::SETPRINTRANGE_OVERWRITE)
Set print area.
setHorizontalCentered($value)
Set center page horizontally.
const PAPERSIZE_C65_ENVELOPE
const PAPERSIZE_LETTER_TRANSVERSE_PAPER
const PAPERSIZE_STANDARD_2
addPrintAreaByColumnAndRow($column1, $row1, $column2, $row2, $index=-1)
Add a new print area to the list of print areas.
setVerticalCentered($value)
Set center page vertically.
const PAPERSIZE_LETTER_EXTRA_TRANSVERSE_PAPER
getHorizontalCentered()
Get center page horizontally.
const PAPERSIZE_B6_ENVELOPE
getPrintArea($index=0)
Get print area.
getOrientation()
Get Orientation.
isRowsToRepeatAtTopSet()
Is Rows to repeat at top set?
getFirstPageNumber()
Get first page number.
const PAGEORDER_DOWN_THEN_OVER
setFitToHeight($pValue, $pUpdate=true)
Set Fit To Height.
const ORIENTATION_DEFAULT
const PAPERSIZE_LETTER_SMALL
const PAPERSIZE_STANDARD_1
const PAPERSIZE_STANDARD_PAPER_1
const SETPRINTRANGE_INSERT
const PAPERSIZE_C6_ENVELOPE
const ORIENTATION_PORTRAIT
setColumnsToRepeatAtLeftByStartAndEnd($pStart, $pEnd)
Set Columns to repeat at left by start and end.
const PAPERSIZE_NO12_ENVELOPE
const PAPERSIZE_JAPANESE_DOUBLE_POSTCARD
setOrientation($pValue)
Set Orientation.
const PAPERSIZE_GERMAN_STANDARD_FANFOLD
setFitToPage($pValue)
Set Fit To Page.
isColumnsToRepeatAtLeftSet()
Is Columns to repeat at left set?
setScale($pValue, $pUpdate=true)
Set Scale.
const PAPERSIZE_LETTER_EXTRA_PAPER