public static function run($dataDir = null)
 {
     # Call the diagram constructor to load diagram from a VSD file
     $diagram = new Diagram($dataDir . "drawing.vsd");
     # Get max page ID
     //        $max_page_id = get_max_page_id($diagram);
     $max_page_id = $diagram->getPages()->getPage(0)->getID();
     $i = 1;
     while ($i < (int) (string) $diagram->getPages()->getCount()) {
         if ($max_page_id < $diagram->getPages()->getPage($i)->getID()) {
             $max_page_id = $diagram->getPages()->getPage($i)->getID();
         }
         $i += 1;
     }
     # Initialize a new page object
     $new_page = new Page();
     # Set name
     $new_page->setName("new page");
     # Set page ID
     $new_page->setID((int) (string) $max_page_id + 1);
     # Or try the Page constructor
     # Page newPage = new Page(MaxPageId + 1);
     # Add a new blank page
     $diagram->getPages()->add($new_page);
     # Save diagram
     $saveFileFormat = new SaveFileFormat();
     $diagram->save($dataDir . "NewPage_Output.vdx", $saveFileFormat->VDX);
     print "Added new page." . PHP_EOL;
 }
 public static function run($dataDir = null)
 {
     # Create instance of Diagram
     $diagram = new Diagram($dataDir . "Drawing.vsd");
     # convert image into bytes array
     $fi = new File($dataDir . "star.png");
     $files = new Files();
     $file_content = $files->readAllBytes($fi->toPath());
     $shapes = $diagram->getPages()->getPage("Flow 1")->getShapes();
     $i = 0;
     $typeValue = new TypeValue();
     while ($i < (int) (string) $shapes->getCount()) {
         $shape = $shapes->get($i);
         # Filter shapes by type Foreign
         if ($shape->getType() == $typeValue->FOREIGN) {
             # replace picture shape
             $shape->getForeignData()->setValue($file_content);
         }
         $i += 1;
     }
     # Save diagram
     $saveFileFormat = new SaveFileFormat();
     $diagram->save($dataDir . "ReplacePictureShape.vdx", $saveFileFormat->VDX);
     print "Replaced picture shape successfully!" . PHP_EOL;
 }
 public static function run($dataDir = null)
 {
     # Create instance of Diagram
     $diagram = new Diagram($dataDir . "Drawing.vsd");
     $shapes = $diagram->getPages()->getPage("Flow 1")->getShapes();
     $i = 0;
     while ($i < (int) (string) $shapes->getCount()) {
         $shape = $shapes->get($i);
         #puts shape.getName().to_s
         if ($shape->getName() == "Process") {
             # Add shape1 in first two layers. Here "0;1" are indexes of the layers
             $layer = $shape->getLayerMem();
             $layer->getLayerMember()->setValue("0;1");
         } elseif ($shape->getName() == "Preparation") {
             # Remove shape2 from all the layers
             $layer = $shape->getLayerMem();
             $layer->getLayerMember()->setValue("");
         }
         $i += 1;
     }
     # Save diagram
     $saveFileFormat = new SaveFileFormat();
     $diagram->save($dataDir . "Layers.vdx", $saveFileFormat->VDX);
     print "Configured Shape Objects with Layers in Visio." . PHP_EOL;
 }
 public static function run($dataDir = null)
 {
     # Create instance of Diagram
     $diagram = new Diagram($dataDir . "drawing.vsd");
     $page = $diagram->getPages()->getPage("Flow 1");
     $shape = $page->getShapes()->getShape(1);
     $shape->getProtection()->getLockAspect()->setValue(1);
     $shape->getProtection()->getLockBegin()->setValue(1);
     $shape->getProtection()->getLockCalcWH()->setValue(1);
     $shape->getProtection()->getLockCrop()->setValue(1);
     $shape->getProtection()->getLockCustProp()->setValue(1);
     $shape->getProtection()->getLockDelete()->setValue(1);
     $shape->getProtection()->getLockEnd()->setValue(1);
     $shape->getProtection()->getLockFormat()->setValue(1);
     $shape->getProtection()->getLockFromGroupFormat()->setValue(1);
     $shape->getProtection()->getLockGroup()->setValue(1);
     $shape->getProtection()->getLockHeight()->setValue(1);
     $shape->getProtection()->getLockMoveX()->setValue(1);
     $shape->getProtection()->getLockMoveY()->setValue(1);
     $shape->getProtection()->getLockRotate()->setValue(1);
     $shape->getProtection()->getLockSelect()->setValue(1);
     $shape->getProtection()->getLockTextEdit()->setValue(1);
     $shape->getProtection()->getLockThemeColors()->setValue(1);
     $shape->getProtection()->getLockThemeEffects()->setValue(1);
     $shape->getProtection()->getLockVtxEdit()->setValue(1);
     $shape->getProtection()->getLockWidth()->setValue(1);
     # Save diagram
     $saveFileFormat = new SaveFileFormat();
     $diagram->save($dataDir . "ProtectUnprotectShape.vdx", $saveFileFormat->VDX);
     print "Applied protection on shape successfully!" . PHP_EOL;
 }
 public static function run($dataDir = null)
 {
     # Create instance of Diagram
     $diagram = new Diagram($dataDir . "Basic_Shapes.vsd");
     # get Visio page
     $page = $diagram->getPages()->getPage(0);
     # initialize a new Layer class object
     $layer = new Layer();
     # set Layer name
     $layer->getName()->setValue("Layer2");
     # set Layer Visibility
     $layer->getVisible()->setValue(2);
     # add Layer to the particular page sheet
     $page->getPageSheet()->getLayers()->add($layer);
     # add a new shape
     $shape_id = $page->addShape(3.0, 3.0, 0.36, 0.36, "Circle");
     # get the Shape object
     $shape = $page->getShapes()->getShape($shape_id);
     # assign this new Layer
     $shape->getLayerMem()->getLayerMember()->setValue((string) $layer->getIX());
     # Save diagram
     $saveFileFormat = new SaveFileFormat();
     $diagram->save($dataDir . "AddNewLayer.vdx", $saveFileFormat->VDX);
     print "Added a new Layer in the Visio Diagram." . PHP_EOL;
 }
 public static function run($dataDir = null)
 {
     # Create instance of Diagram
     $diagram = new Diagram($dataDir . "Drawing.vsd");
     $pages = $diagram->getPages();
     $i = 0;
     while ($i < (int) (string) $pages->getCount()) {
         $page = $pages->get($i);
         $shapes = $page->getShapes();
         $j = 0;
         while ($j < (int) (string) $shapes->getCount()) {
             $shape = $shapes->get($j);
             if ($shape->getNameU() == "Process") {
                 # Initialize user object
                 $user = new User();
                 $user->setName("UserDefineCell");
                 $user->getValue()->setVal("800");
                 # Add user-defined cell
                 $shape->getUsers()->add($user);
             }
             $j += 1;
         }
         $i += 1;
     }
     # Save diagram
     $saveFileFormat = new SaveFileFormat();
     $diagram->save($dataDir . "UserDefinedCells.vdx", $saveFileFormat->VDX);
     print "Created User-defined Cell in the ShapeSheet." . PHP_EOL;
 }
 public static function run($dataDir = null)
 {
     # Create instance of Diagram
     $diagram = new Diagram($dataDir . "drawing.vdx");
     $pages = $diagram->getPages();
     $count = 0;
     while ($count < (int) (string) $pages->getCount()) {
         $page = $pages->get($count);
         $shapes = $page->getShapes();
         $i = 0;
         while ($i < (int) (string) $shapes->getCount()) {
             $shape = $shapes->get($i);
             if ($shape->getNameU() == "Process") {
                 $users = $shape->getUsers();
                 $j = 0;
                 while ($j < (int) (string) $users->getCount()) {
                     $user = $users->get($j);
                     print "Name: " . $user->getNameU() . " Value: " . $user->getValue()->getVal() . " Prompt: " . $user->getPrompt()->getValue();
                     $j += 1;
                 }
                 break;
             }
             $i += 1;
         }
         $count += 1;
     }
 }
 public static function run($dataDir = null)
 {
     # Call the diagram constructor to load diagram from a VSD file
     $diagram = new Diagram($dataDir . "drawing.vsd");
     #page = diagram.getPages().getPage(page_id)
     $page = $diagram->getPages()->getPage(0);
     print "Page ID : " . $page->getName() . PHP_EOL;
 }
 public static function get_page_object_by_name($dataDir = null)
 {
     # Call the diagram constructor to load diagram from a VSD file
     $diagram = new Diagram($dataDir . "drawing.vsd");
     # Set page name
     $page_name = "Flow 1";
     # Get page object by name
     $page = $diagram->getPages()->getPage($page_name);
     print "Page : " . (string) $page . PHP_EOL;
 }
 public static function run($dataDir = null)
 {
     # 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 ($shape->getNameU() == "rectangle" && $shape->getID() == 1) {
             $shape->getFill()->getFillBkgnd()->setValue($diagram->getPages()->getPage(0)->getShapes()->getShape(0)->getFill()->getFillBkgnd()->getValue());
             $shape->getFill()->getFillForegnd()->setValue("#ebf8df");
         }
         $i += 1;
     }
     # Save diagram
     $saveFileFormat = new SaveFileFormat();
     $diagram->save($dataDir . "SetShapeFillData.vdx", $saveFileFormat->VDX);
     print "Set visio shape's fill data." . PHP_EOL;
 }
 public static function run($dataDir = null)
 {
     # Create instance of Diagram
     $diagram = new Diagram($dataDir . "Drawing.vsd");
     $shapes = $diagram->getPages()->getPage(0)->getShapes();
     $i = 0;
     while ($i < (int) (string) $shapes->getCount()) {
         $shape = $shapes->get($i);
         if ($shape->getNameU() == "rectangle" && (int) (string) $shape->getID() == 1) {
             $shape->getLine()->getLineColor()->setValue($diagram->getPages()->getPage(0)->getShapes()->getShape(1)->getFill()->getFillForegnd()->getValue());
             $shape->getLine()->getLineWeight()->setValue(0.07041666666666667);
             $shape->getLine()->getRounding()->setValue(0.1);
         }
         $i += 1;
     }
     # Save diagram
     $saveFileFormat = new SaveFileFormat();
     $diagram->save($dataDir . "SetShapeLineData.vdx", $saveFileFormat->VDX);
     print "Set visio shape's line data." . PHP_EOL;
 }
 public static function run($dataDir = null)
 {
     # Create instance of Diagram
     $diagram = new Diagram($dataDir . "Drawing.vsd");
     # Add a shape and set the angle
     $diagram->getPages()->getPage(0)->getShapes()->getShape(1)->setAngle(190);
     # Save diagram
     $saveFileFormat = new SaveFileFormat();
     $diagram->save($dataDir . "RotateShape.vdx", $saveFileFormat->VDX);
     print "Rotated shape." . PHP_EOL;
 }
 public static function run($dataDir = null)
 {
     # Create instance of Diagram
     $diagram = new Diagram($dataDir . "Drawing.vsd");
     # Add comment
     $diagram->getPages()->getPage(0)->addComment(7.205905511811023, 3.880708661417323, "test@");
     # Save as VDX
     $saveFileFormat = new SaveFileFormat();
     $diagram->save($dataDir . "AddComment.vdx", $saveFileFormat->VDX);
     print "Added comment successfully!" . PHP_EOL;
 }
 public static function run($dataDir = null)
 {
     # Crezate instance of Diagram
     $diagram = new Diagram($dataDir . "Drawing.vsd");
     $connectors = $diagram->getPages()->getPage(0)->getConnects();
     $i = 0;
     while ($i < sizeof($connectors->getCount())) {
         $connector = $connectors->get($i);
         # Display information about the Connectors
         print "From Shape ID : " . (string) $connector->getFromSheet() . PHP_EOL;
         print "To Shape ID : " . (string) $connector->getToSheet() . PHP_EOL;
         $i += 1;
     }
 }
 public static function read_shape_property_by_name($dataDir = null)
 {
     # Create instance of Diagram
     $diagram = new Diagram($dataDir . "Drawing.vsd");
     $shapes = $diagram->getPages()->getPage(0)->getShapes();
     $i = 0;
     while ($i < (int) (string) $shapes->getCount()) {
         $shape = $shapes->get($i);
         if ($shape->getName() == "Process") {
             $property = $shape->getProps()->getProp("Cost");
             print $property->getLabel()->getValue() . ": " . $property->getValue()->getVal() . PHP_EOL;
         }
         $i += 1;
     }
 }
 public static function run($dataDir = null)
 {
     # Create instance of Diagram
     $diagram = new Diagram($dataDir . "Drawing1.vsd");
     $shapes = $diagram->getPages()->getPage(0)->getShapes();
     $i = 0;
     while ($i < (int) (string) $shapes->getCount()) {
         $shape = $shapes->get($i);
         # Display information about the shapes
         print "Shape ID : " . (string) $shape->getID() . PHP_EOL;
         print "Name : " . (string) $shape->getName() . PHP_EOL;
         print "Master Shape : " . (string) $shape->getMaster()->getName() . PHP_EOL;
         $i += 1;
     }
 }
 public static function run($dataDir = null)
 {
     # Create instance of Diagram
     $diagram = new Diagram($dataDir . "Drawing.vsd");
     # Access a particular page
     $page = $diagram->getPages()->getPage("Flow 1");
     # get a particular connector shape
     $shape = $page->getShapes()->getShape(1);
     # set reroute option
     $conFixedCodeValue = new ConFixedCodeValue();
     $shape->getLayout()->getConFixedCode()->setValue($conFixedCodeValue->NEVER_REROUTE);
     # Save diagram
     $saveFileFormat = new SaveFileFormat();
     $diagram->save($dataDir . "SelectRerouteOption.vdx", $saveFileFormat->VDX);
     print "Seleted reroute option of the connector shape." . PHP_EOL;
 }
 public static function run($dataDir = null)
 {
     # Create instance of Diagram
     $diagram = new Diagram($dataDir . "drawing.vdx");
     # Get a particular shape
     $shape = $diagram->getPages()->getPage("Flow 1")->getShapes()->getShape(1);
     $hyperlinks = $shape->getHyperlinks();
     $i = 0;
     while ($i < (int) (string) $hyperlinks->getCount()) {
         $hyperlink = $hyperlinks->get($i);
         print "Address: " . (string) $hyperlink->getAddress()->getValue();
         print "Sub Address: " . (string) $hyperlink->getSubAddress()->getValue();
         print "Description: " . (string) $hyperlink->getDescription()->getValue();
         $i += 1;
     }
 }
 public static function run($dataDir = null)
 {
     # Create instance of Diagram
     $diagram = new Diagram($dataDir . "Drawing.vsd");
     # get Visio page
     $page = $diagram->getPages()->getPage(0);
     $layers = $page->getPageSheet()->getLayers();
     $i = 0;
     while ($i < $layers->getCount()) {
         $layer = $layers->get($i);
         print "Name: " . (string) $layer->getName()->getValue();
         print "Visibility: " . (string) $layer->getVisible()->getValue();
         print "Status: " . (string) $layer->getStatus()->getValue();
         $i += 1;
     }
 }
 public static function run($dataDir = null)
 {
     # Create instance of Diagram
     $diagram = new Diagram($dataDir . "Drawing.vsd");
     # Access a particular page
     $page = $diagram->getPages()->getPage("Flow 1");
     # get a particular connector shape
     $shape = $page->getShapes()->getShape(1);
     # set dynamic connector appearance
     $connectorsTypeValue = new ConnectorsTypeValue();
     $shape->setConnectorsType($connectorsTypeValue->STRAIGHT_LINES);
     # Save diagram
     $saveFileFormat = new SaveFileFormat();
     $diagram->save($dataDir . "SetShapeAppearance.vdx", $saveFileFormat->VDX);
     print "Set appearnce of the connector type shape." . PHP_EOL;
 }
 public static function run($dataDir = null)
 {
     # Create instance of Diagram
     $diagram = new Diagram($dataDir . "Drawing.vsd");
     # Get a particular shape
     $shape = $diagram->getPages()->getPage("Flow 1")->getShapes()->getShape(1);
     # Clear shape text values and chars
     $shape->getText()->getValue()->clear();
     $shape->getChars()->clear();
     # Mark character run and add text
     $shape->getText()->getValue()->add(new Cp(0));
     $shape->getText()->getValue()->add(new Txt("TextStyle_Regular"));
     $shape->getText()->getValue()->add(new Cp(1));
     $shape->getText()->getValue()->add(new Txt("TextStyle_Bold_Italic"));
     $shape->getText()->getValue()->add(new Cp(2));
     $shape->getText()->getValue()->add(new Txt("TextStyle_Underline_Italic"));
     $shape->getText()->getValue()->add(new Cp(3));
     $shape->getText()->getValue()->add(new Txt("TextStyle_Bold_Italic_Underline"));
     # Add formatting characters
     $shape->getChars()->add(new Char());
     $shape->getChars()->add(new Char());
     $shape->getChars()->add(new Char());
     $shape->getChars()->add(new Char());
     $style_value = new StyleValue();
     # Set properties e.g. color, font, size and style etc.
     $shape->getChars()->getChar(0)->setIX(0);
     $shape->getChars()->getChar(0)->getColor()->setValue("#FF0000");
     $shape->getChars()->getChar(0)->getFont()->setValue(4);
     $shape->getChars()->getChar(0)->getSize()->setValue(0.22);
     $shape->getChars()->getChar(0)->getStyle()->setValue($style_value->UNDEFINED);
     # Set properties e.g. color, font, size and style etc.
     $shape->getChars()->getChar(1)->setIX(1);
     $shape->getChars()->getChar(1)->getColor()->setValue("#FF00FF");
     $shape->getChars()->getChar(1)->getFont()->setValue(4);
     $shape->getChars()->getChar(1)->getSize()->setValue(0.22);
     (int) (string) $shape->getChars()->getChar(1)->getStyle()->setValue((string) $style_value->BOLD | (string) $style_value->ITALIC);
     # Set properties e.g. color, font, size and style etc.
     $shape->getChars()->getChar(2)->setIX(2);
     $shape->getChars()->getChar(2)->getColor()->setValue("#00FF00");
     $shape->getChars()->getChar(2)->getFont()->setValue(4);
     $shape->getChars()->getChar(2)->getSize()->setValue(0.22);
     (int) (string) $shape->getChars()->getChar(2)->getStyle()->setValue((string) $style_value->UNDERLINE | (string) $style_value->ITALIC);
     # Save diagram
     $saveFileFormat = new SaveFileFormat();
     $diagram->save($dataDir . "AddShapeTextAndStyles.vdx", $saveFileFormat->VDX);
     print "Added shape text and styles." . PHP_EOL;
 }
 public static function run($dataDir = null)
 {
     # Create instance of Diagram
     $diagram = new Diagram($dataDir . "Drawing.vsd");
     $shapes = $diagram->getPages()->getPage(0)->getShapes();
     $i = 0;
     while ($i < (int) (string) $shapes->getCount()) {
         $shape = $shapes->get($i);
         if ($shape->getNameU() == "Process" && (int) (string) $shape->getID() == 2) {
             $shape->move(1, 1);
         }
         $i += 1;
     }
     # Save diagram
     $saveFileFormat = new SaveFileFormat();
     $diagram->save($dataDir . "ChangeShapePosition.vdx", $saveFileFormat->VDX);
     print "Changed postion of a shape." . PHP_EOL;
 }
 public static function run($dataDir = null)
 {
     # Create instance of Diagram
     $diagram = new Diagram($dataDir . "Drawing.vsd");
     $shapes = $diagram->getPages()->getPage(0)->getShapes();
     $i = 0;
     while ($i < (int) (string) $shapes->getCount()) {
         $shape = $shapes->get($i);
         if ($shape->getNameU() == "Process" && (int) (string) $shape->getID() == 1) {
             $shape->getText()->getValue()->clear();
             $shape->getText()->getValue()->add(new Txt("New Text"));
         }
         $i += 1;
     }
     # Save diagram
     $saveFileFormat = new SaveFileFormat();
     $diagram->save($dataDir . "UpdateShapeText.vdx", $saveFileFormat->VDX);
     print "Updated shape text." . PHP_EOL;
 }
 public static function run($dataDir = null)
 {
     # Create instance of Diagram
     $diagram = new Diagram($dataDir . "Drawing.vsd");
     $shapes = $diagram->getPages()->getPage(0)->getShapes();
     $i = 0;
     while ($i < (int) (string) $shapes->getCount()) {
         $shape = $shapes->get($i);
         if ($shape->getNameU() == "process" && $shape->getID() == 1) {
             $shape->getXForm()->getPinX()->setValue(5);
             $shape->getXForm()->getPinY()->setValue(5);
         }
         $i += 1;
     }
     # Save diagram
     $saveFileFormat = new SaveFileFormat();
     $diagram->save($dataDir . "SetShapeXFormData.vdx", $saveFileFormat->VDX);
     print "Set visio shape's XForm data." . PHP_EOL;
 }
 public static function run($dataDir = null)
 {
     # 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;
 }
 public static function run($dataDir = null)
 {
     # Create instance of Diagram
     $diagram = new Diagram($dataDir . "Drawing.vsd");
     $shape_id = 1;
     # Get timeline shape
     $milestone = $diagram->getPages()->getPage("Flow 1")->getShapes()->getShape($shape_id);
     # Initialize MilestoneHelper object
     $milestone_helper = new MilestoneHelper($milestone);
     # Set date format
     $milestone_helper->setDateFormat(21);
     # Set auto update flag
     $milestone_helper->setAutoUpdate(true);
     # Set milestone type
     $milestone_helper->setType(6);
     # Save diagram
     $saveFileFormat = new SaveFileFormat();
     $diagram->save($dataDir . "SetMilestoneShapeProperties.vdx", $saveFileFormat->VDX);
     print "Set milestone shape properties." . PHP_EOL;
 }
 public static function run($dataDir = null)
 {
     # Create instance of Diagram
     $diagram = new Diagram($dataDir . "drawing.vsd");
     $shapes = $diagram->getPages()->getPage("Flow 1")->getShapes();
     $i = 0;
     $typeValue = new TypeValue();
     while ($i < (int) (string) $shapes->getCount()) {
         $shape = $shapes->get($i);
         # Filter shapes by type Foreign
         if ($shape->getType() == $typeValue->FOREIGN) {
             # create an image file
             $fos = new FileOutputStream($dataDir . "Image#{i}.bmp");
             $fos->write($shape->getForeignData()->getValue());
             $fos->close();
         }
         $i += 1;
     }
     print "Extracted images successfully!" . PHP_EOL;
 }
 public static function run($dataDir = null)
 {
     # Create instance of Diagram
     $diagram = new Diagram($dataDir . "Drawing.vsd");
     # Initialize Hyperlink object
     $hyperlink = new Hyperlink();
     # Set address value
     $hyperlink->getAddress()->setValue("http://www.google.com/");
     # Set sub address value
     $hyperlink->getSubAddress()->setValue("Sub address here");
     # Set description value
     $hyperlink->getDescription()->setValue("Description here");
     # Set name
     $hyperlink->setName("MyHyperLink");
     # Add hyperlink to the shape
     $diagram->getPages()->getPage("Flow 1")->getShapes()->getShape(1)->getHyperlinks()->add($hyperlink);
     # Save diagram
     $saveFileFormat = new SaveFileFormat();
     $diagram->save($dataDir . "Hyperlinks.vdx", $saveFileFormat->VDX);
     print "Added hyperlik to shape successfully!" . PHP_EOL;
 }
 public static function run($dataDir = null)
 {
     # Call the diagram constructor to load diagram from a VSD file
     $diagram = new Diagram($dataDir . "Drawing.vsd");
     #set connector shape id
     $connector_id = 1;
     $connector = $diagram->getPages()->getPage(0)->getShapes()->getShape($connector_id);
     # get connector geometry at index 0
     $defaultLineTo = $connector->getGeoms()->get(0)->getCoordinateCol()->getLineToCol()->get(0);
     # remove connector geometry from index 0
     $connector->getGeoms()->get(0)->getCoordinateCol()->getLineToCol()->get(0)->setDel(1);
     # initialize LineTo geometry object
     $line_to = new LineTo();
     # set X value
     $line_to->getX()->setValue(0);
     # set Y value
     $line_to->getY()->setValue((int) (string) $defaultLineTo->getY()->getValue() / 2);
     # add connector geometry
     $connector->getGeoms()->get(0)->getCoordinateCol()->add($line_to);
     # initialize LineTo geometry object
     $line_to = new LineTo();
     # set Y value
     $line_to->getY()->setValue((int) (string) $defaultLineTo->getY()->getValue() / 2);
     # set X value
     $line_to->getX()->setValue($defaultLineTo->getX()->getValue());
     # add connector geometry
     $connector->getGeoms()->get(0)->getCoordinateCol()->add($line_to);
     # initialize LineTo geometry object
     $line_to = new LineTo();
     # set X value
     $line_to->getX()->setValue($defaultLineTo->getX()->getValue());
     # set Y value
     $line_to->getY()->setValue($defaultLineTo->getY()->getValue());
     # add connector geometry
     $connector->getGeoms()->get(0)->getCoordinateCol()->add($line_to);
     # Save as Html
     $saveFileFormat = new SaveFileFormat();
     $diagram->save($dataDir . "Geometry.vdx", $saveFileFormat->VDX);
     print "Updated Connector Geometry Section in the ShapeSheet." . PHP_EOL;
 }
 public static function run($dataDir = null)
 {
     # Create instance of Diagram
     $diagram = new Diagram($dataDir . "Drawing.vsd");
     $shapes = $diagram->getPages()->getPage(0)->getShapes();
     $i = 0;
     while ($i < (int) (string) $shapes->getCount()) {
         $shape = $shapes->get($i);
         if ($shape->getNameU() == "Process") {
             $source_shape = $shape;
             break;
         }
         $i += 1;
     }
     # Find the required style sheet
     $stylesheets = $diagram->getStyleSheets();
     $j = 0;
     while ($j < (int) (string) $stylesheets->getCount()) {
         $stylesheet = $stylesheets->get($j);
         if ($stylesheet->getName() == "Basic") {
             $custom_stylesheet = $stylesheet;
             break;
         }
         $j += 1;
     }
     if ($source_shape != null && $custom_stylesheet != null) {
         # Apply text style
         $source_shape->setTextStyle($custom_stylesheet);
         # Apply fill style
         $source_shape->setFillStyle($custom_stylesheet);
         # Apply line style
         $source_shape->setLineStyle($custom_stylesheet);
     }
     # Save diagram
     $saveFileFormat = new SaveFileFormat();
     $diagram->save($dataDir . "ApplyCustomStyleSheet.vdx", $saveFileFormat->VDX);
     print "Applied custom stylesheet to a visio diagram." . PHP_EOL;
 }