具体实现代码如下:
$shape = $slide->createRichTextShape(); $shape->setHeight(80); $shape->setWidth(950); $shape->setOffsetX(57); $shape->setOffsetY(150); $shape->getActiveParagraph()->getAlignment()->setHorizontal(Alignment::HORIZONTAL_LEFT)->setMarginLeft(0)->setIndent(-20); $shape->getActiveParagraph()->setLineSpacing(100000); //默认就是100000 $shape->getActiveParagraph()->getBulletStyle()->setBulletType('bullet')->setBulletChar('•'); $textRun = $shape->createTextRun('Date: '.date('M j Y',$res['mtrqf'])); $textRun->getFont()->setName("Garamond"); $textRun->getFont()->setSize(10.5); $textRun->getFont()->setColor( new Color('FF000000') ); $textRun = $shape->createParagraph()->createTextRun('Total views: '.number_format($res['fans'])); $textRun->getFont()->setName("Garamond"); $textRun->getFont()->setSize(10.5); $textRun->getFont()->setColor( new Color('FF000000') ); $textRun = $shape->createParagraph()->createTextRun('Total interactions: '.number_format($res['yueduliang'])); $textRun->getFont()->setName("Garamond"); $textRun->getFont()->setSize(10.5); $textRun->getFont()->setColor( new Color('FF000000') );
效果截图
如果本文对你有帮助,欢迎打赏本站