1

PHPPowerPoint是一个很棒的库,但它没有文档。将图像添加到幻灯片的正确语法是什么?

4

2 回答 2

2
$currentSlide = createTemplatedSlide($objPHPPowerPoint); 
// createTemplatedSlide is manual function in PHPpowerPoint

// create a drawing shape object
$shape1 = $currentSlide->createDrawingShape();
$shape1->setName("set name here");
$shape1->setDescription('Link Image');
$shape1->setPath('provide image path here');
$shape1->setWidth(45); // set width
$shape1->setHeight(45); // set height
$shape1->setOffsetX($offset_X); // distance from the left side of the slide
$shape1->setOffsetY($offset_Y); // distance from top of the slide
于 2013-09-17T13:45:49.947 回答
2

每个图形对象都被视为一个“形状”。这是将图像插入幻灯片的方法:

// Create slide 1
$currentSlide = createTemplatedSlide($objPHPPowerPoint); 
        //Slide Content
    $shape = $currentSlide->createDrawingShape();
    $shape->setName('Part page');
    $shape->setDescription('Page');
    $shape->setPath('D:\wamp\www\Project\PPTResource\Part2\Image.jpg'); //This being the directory, wont be the same as mine.
    $shape->setOffsetX(10); //Default values on position of image
    $shape->setOffsetY(10);
    $shape->getShadow()->setVisible(true);
    $shape->getShadow()->setDirection(45);
    $shape->getShadow()->setDistance(10);
于 2013-04-15T14:22:46.950 回答