Merge pull request #390 from spikex/develop

Add missing setters for pageSizeW and pageSizeH
This commit is contained in:
Progi1984 2014-10-03 09:15:58 +02:00
commit 9d73173dce
4 changed files with 45 additions and 6 deletions

View File

@ -36,6 +36,7 @@ This release added form fields (textinput, checkbox, and dropdown), drawing shap
- Fix specific borders (and margins) were not written correctly in word2007 writer - @pscheit GH-327
- "HTML is not a valid writer" exception while running "Sample_36_RTL.php" - @RomanSyroeshko GH-340
- "addShape()" magic method in AbstractContainer is mistakenly named as "addObject()" - @GMTA GH-356
- `Element\Section::setPageSizeW()` and `Element\Section::setPageSizeH()` were mentioned in the docs but not implemented.
### Deprecated

View File

@ -8,6 +8,8 @@ Section
Below are the available styles for section:
- ``pageSizeW`` Page width in twips (the default is 11906/A4 size)
- ``pageSizeH`` Page height in twips (the default is 16838/A4 size)
- ``orientation`` Page orientation, i.e. 'portrait' (default) or
'landscape'
- ``marginTop`` Page margin top in twips
@ -30,12 +32,6 @@ Below are the available styles for section:
- ``breakType`` Section break type (nextPage, nextColumn, continuous,
evenPage, oddPage)
The following two styles are automatically set by the use of the
``orientation`` style. You can alter them but that's not recommended.
- ``pageSizeW`` Page width in twips
- ``pageSizeH`` Page height in twips
Font
----

View File

@ -282,6 +282,13 @@ class Section extends Border
return $this->pageSizeW;
}
public function setPageSizeW($value = null)
{
$this->pageSizeW = $this->setNumericVal($value, self::DEFAULT_WIDTH);
return $this;
}
/**
* Get Page Size Height
*
@ -292,6 +299,13 @@ class Section extends Border
return $this->pageSizeH;
}
public function setPageSizeH($value = null)
{
$this->pageSizeH = $this->setNumericVal($value, self::DEFAULT_HEIGHT);
return $this;
}
/**
* Get Margin Top
*

View File

@ -97,6 +97,34 @@ class SettingsTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($iVal, $oSettings->getMarginRight());
}
/**
* Set/get page width
*/
public function testPageWidth()
{
// Section Settings
$oSettings = new Section();
$this->assertEquals(Section::DEFAULT_WIDTH, $oSettings->getPageSizeW());
$iVal = rand(1, 1000);
$oSettings->setSettingValue('pageSizeW', $iVal);
$this->assertEquals($iVal, $oSettings->getPageSizeW());
}
/**
* Set/get page height
*/
public function testPageHeight()
{
// Section Settings
$oSettings = new Section();
$this->assertEquals(Section::DEFAULT_HEIGHT, $oSettings->getPageSizeH());
$iVal = rand(1, 1000);
$oSettings->setSettingValue('pageSizeH', $iVal);
$this->assertEquals($iVal, $oSettings->getPageSizeH());
}
/**
* Set/get landscape orientation
*/