如何在phppresentation幻灯片中使用自定义颜色作为背景

时间:2018-02-12 18:19:19

标签: background-color phppresentation

我希望能够使用自定义颜色,但似乎无法绕过styleColor常量。如何输入我自己的颜色,如#008080

// Create slide
echo date('H:i:s') . ' Create slide'.EOL;
$oSlide1 = $objPHPPresentation->getActiveSlide();
$oSlide1->addShape(clone $oShapeDrawing);
$oSlide1->addShape(clone $oShapeRichText);
// Slide > Background > Color
$oBkgColor = new Color();
$oBkgColor->setColor(new StyleColor(StyleColor::COLOR_DARKGREEN));
$oSlide1->setBackground($oBkgColor);

1 个答案:

答案 0 :(得分:0)

你可以这样做:

// Create slide
echo date('H:i:s') . ' Create slide'.EOL;
$oSlide1 = $objPHPPresentation->getActiveSlide();
$oSlide1->addShape(clone $oShapeDrawing);
$oSlide1->addShape(clone $oShapeRichText);
// Slide > Background > Color
$oColor = new StyleColor();
$oColor->setRGB('008080');
$oBkgColor = new Color();
$oBkgColor->setColor($oColor);
$oSlide1->setBackground($oBkgColor);