Ejemplo n.º 1
0
 public function testOffsetY()
 {
     $object = new Title();
     $value = rand(0, 100);
     $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Title', $object->setOffsetY());
     $this->assertEquals(0.01, $object->getOffsetY());
     $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\Chart\\Title', $object->setOffsetY($value));
     $this->assertEquals($value, $object->getOffsetY());
 }
Ejemplo n.º 2
0
 /**
  * @param Title $oTitle
  */
 private function writeTitle(Title $oTitle)
 {
     if ($oTitle->isVisible()) {
         // chart:title
         $this->xmlContent->startElement('chart:title');
         $this->xmlContent->writeAttribute('svg:x', String::numberFormat(CommonDrawing::pixelsToCentimeters($oTitle->getOffsetX()), 3) . 'cm');
         $this->xmlContent->writeAttribute('svg:y', String::numberFormat(CommonDrawing::pixelsToCentimeters($oTitle->getOffsetY()), 3) . 'cm');
         $this->xmlContent->writeAttribute('chart:style-name', 'styleTitle');
         // > text:p
         $this->xmlContent->startElement('text:p');
         $this->xmlContent->text($oTitle->getText());
         // > text:p
         $this->xmlContent->endElement();
         // > chart:title
         $this->xmlContent->endElement();
     }
 }