PhpOffice\PhpPresentation\Shape\Group::createLineShape PHP Method

createLineShape() public method

Create line shape
public createLineShape ( integer $fromX, integer $fromY, integer $toX, integer $toY ) : Line
$fromX integer Starting point x offset
$fromY integer Starting point y offset
$toX integer Ending point x offset
$toY integer Ending point y offset
return Line
    public function createLineShape($fromX, $fromY, $toX, $toY)
    {
        $shape = new Line($fromX, $fromY, $toX, $toY);
        $this->addShape($shape);
        return $shape;
    }

Usage Example

示例#1
0
 public function testAdd()
 {
     $object = new Group();
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart', $object->createChartShape());
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Drawing', $object->createDrawingShape());
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Line', $object->createLineShape(10, 10, 10, 10));
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $object->createRichTextShape());
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Table', $object->createTableShape());
     $this->assertEquals(5, $object->getShapeCollection()->count());
 }