Set the Height and Width of a Shape in PHP

Aspose.Diagram - Set the Height and Width of a Shape

To Set the Height and Width of a Shape using Aspose.Diagram Java for PHP, simply invoke SetShapeHeightAndWidth module. Here you can see example code.

PHP Code

 # Create instance of Diagram

$diagram=new Diagram($dataDir."Drawing.vsd");

$shapes=$diagram->getPages()->getPage(0)->getShapes();

$i=0;

while ($i <sizeof($shapes->getCount())) {

$shape = $shapes->get($i);

if ((string)$shape->getNameU()=="Process" && (int)(string)$shape->getID()==1) {

$shape->setWidth(2 * (int)(string)$shape->getXForm()->getWidth()->getValue());

$shape->setHeight(2 * (int)(string)$shape->getXForm()->getHeight()->getValue());

}

$i += 1;

}

\# Save diagram

$saveFileFormat=new SaveFileFormat();

$diagram->save($dataDir."SetShapeHeightAndWidth.vdx",$saveFileFormat->VDX);

print "Set height and width of shape.".PHP_EOL;

Download Running Code

Download Set the Height and Width of a Shape (Aspose.Diagram) from any of the below mentioned social coding sites: