setDocumentLayout() public method

Set Document Layout
public setDocumentLayout ( array | string $pValue = self::LAYOUT_SCREEN_4X3, boolean $isLandscape = true ) : DocumentLayout
$pValue array | string
$isLandscape boolean
return DocumentLayout
 /**
  * Test set custom layout
  */
 public function testSetCustomLayout()
 {
     $object = new DocumentLayout();
     $object->setDocumentLayout(array('cx' => 6858000, 'cy' => 9144000), false);
     $this->assertEquals(DocumentLayout::LAYOUT_CUSTOM, $object->getDocumentLayout());
     $this->assertEquals(9144000, $object->getCX());
     $this->assertEquals(6858000, $object->getCY());
     $object->setDocumentLayout(array('cx' => 6858000, 'cy' => 9144000), true);
     $this->assertEquals(DocumentLayout::LAYOUT_CUSTOM, $object->getDocumentLayout());
     $this->assertEquals(6858000, $object->getCX());
     $this->assertEquals(9144000, $object->getCY());
 }
示例#2
0
 public function testCustomDocumentLayout()
 {
     $oPhpPresentation = new PhpPresentation();
     $oDocumentLayout = new DocumentLayout();
     $oDocumentLayout->setDocumentLayout(array('cx' => rand(1, 100), 'cy' => rand(1, 100)));
     $oPhpPresentation->setLayout($oDocumentLayout);
     $pres = TestHelperDOCX::getDocument($oPhpPresentation, 'ODPresentation');
     $element = "/office:document-styles/office:automatic-styles/style:page-layout";
     $this->assertTrue($pres->elementExists($element, 'styles.xml'));
     $this->assertEquals('sPL0', $pres->getElementAttribute($element, 'style:name', 'styles.xml'));
     $element = "/office:document-styles/office:master-styles/style:master-page";
     $this->assertTrue($pres->elementExists($element, 'styles.xml'));
     $this->assertEquals('sPL0', $pres->getElementAttribute($element, 'style:page-layout-name', 'styles.xml'));
 }