PhpPresentation上下标文字展示设置可以使用字体类方法setSuperScript进行设置,具体如下代码:
$textRun = $shape->createTextRun(date('F ', $res['mtrqf']));
$textRun->getFont()->setBold(false);
$textRun->getFont()->setName("Century Gothic");
$textRun->getFont()->setSize(16);
$textRun->getFont()->setColor(new Color('FF000000'));
// $textRun = $shape->createTextRun(date('jS Y', $res['mtrqf']));
$textRun = $shape->createTextRun(date('j', $res['mtrqf']));
$textRun->getFont()->setBold(true);
$textRun->getFont()->setName("Century Gothic");
$textRun->getFont()->setSize(16);
$textRun->getFont()->setColor(new Color('FF000000'));
$textRun = $shape->createTextRun(date('S', $res['mtrqf']));
$textRun->getFont()->setBold(true);
$textRun->getFont()->setSuperScript(true);//上标
$textRun->getFont()->setName("Century Gothic");
$textRun->getFont()->setSize(16);
$textRun->getFont()->setColor(new Color('FF000000'));
$textRun = $shape->createTextRun(date(' Y', $res['mtrqf']));
$textRun->getFont()->setBold(true);
// $textRun->getFont()->setSuperScript(false); //下标
$textRun->getFont()->setName("Century Gothic");
$textRun->getFont()->setSize(16);
$textRun->getFont()->setColor(new Color('FF000000'));
相关文章