getActiveParagraph() public method

Get active paragraph
public getActiveParagraph ( ) : Paragraph
return PhpOffice\PhpPresentation\Shape\RichText\Paragraph
Exemplo n.º 1
0
if (CLI) {
    return;
}
// Set titles and names
$pageHeading = str_replace('_', ' ', SCRIPT_FILENAME);
$pageTitle = IS_INDEX ? 'Welcome to ' : "{$pageHeading} - ";
$pageTitle .= 'PHPPresentation';
$pageHeading = IS_INDEX ? '' : "<h1>{$pageHeading}</h1>";
$oShapeDrawing = new Drawing\File();
$oShapeDrawing->setName('PHPPresentation logo')->setDescription('PHPPresentation logo')->setPath('./resources/phppowerpoint_logo.gif')->setHeight(36)->setOffsetX(10)->setOffsetY(10);
$oShapeDrawing->getShadow()->setVisible(true)->setDirection(45)->setDistance(10);
$oShapeDrawing->getHyperlink()->setUrl('https://github.com/PHPOffice/PHPPresentation/')->setTooltip('PHPPresentation');
// Create a shape (text)
$oShapeRichText = new RichText();
$oShapeRichText->setHeight(300)->setWidth(600)->setOffsetX(170)->setOffsetY(180);
$oShapeRichText->getActiveParagraph()->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
$textRun = $oShapeRichText->createTextRun('Thank you for using PHPPresentation!');
$textRun->getFont()->setBold(true)->setSize(60)->setColor(new Color('FFE06B20'));
// Populate samples
$files = '';
if ($handle = opendir('.')) {
    while (false !== ($file = readdir($handle))) {
        if (preg_match('/^Sample_\\d+_/', $file)) {
            $name = str_replace('_', ' ', preg_replace('/(Sample_|\\.php)/', '', $file));
            $files .= "<li><a href='{$file}'>{$name}</a></li>";
        }
    }
    closedir($handle);
}
/**
 * Write documents
Exemplo n.º 2
0
 public function testHashCode()
 {
     $object = new RichText();
     $hash = $object->getActiveParagraph()->getHashCode();
     $hash .= RichText::WRAP_SQUARE . RichText::AUTOFIT_DEFAULT . RichText::OVERFLOW_OVERFLOW . RichText::OVERFLOW_OVERFLOW . '0014.89.69.64.8';
     $hash .= md5('00000' . $object->getFill()->getHashCode() . $object->getShadow()->getHashCode() . '' . get_parent_class($object));
     $hash .= get_class($object);
     $this->assertEquals(md5($hash), $object->getHashCode());
 }