PhpOffice\PhpPresentation\Shape\RichText::createTextRun PHP Метод

createTextRun() публичный Метод

Create text run (can be formatted)
public createTextRun ( string $pText = '' ) : PhpOffice\PhpPresentation\Shape\RichText\Run
$pText string Text
Результат PhpOffice\PhpPresentation\Shape\RichText\Run
    public function createTextRun($pText = '')
    {
        return $this->richTextParagraphs[$this->activeParagraph]->createTextRun($pText);
    }

Usage Example

Пример #1
0
    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
 *
All Usage Examples Of PhpOffice\PhpPresentation\Shape\RichText::createTextRun