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 . "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) { # 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"); $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 . "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"); # add page number at the right corner of header $diagram->getHeaderFooter()->setHeaderRight("&p"); # set text at the center $diagram->getHeaderFooter()->setHeaderCenter("Center of the header"); # set text at the left side $diagram->getHeaderFooter()->setHeaderLeft("Left of the header"); # add text at the right corner of footer $diagram->getHeaderFooter()->setFooterRight("Right of the footer"); # set text at the center $diagram->getHeaderFooter()->setFooterCenter("Center of the footer"); # set text at the left side $diagram->getHeaderFooter()->setFooterLeft("Left of the footer"); # set header & footer color $color = new Color(); $diagram->getHeaderFooter()->setHeaderFooterColor($color->getRed()); # set text font properties $diagram->getHeaderFooter()->getHeaderFooterFont()->setItalic(1); $diagram->getHeaderFooter()->getHeaderFooterFont()->setUnderline(0); # Save diagram $saveFileFormat = new SaveFileFormat(); $diagram->save($dataDir . "HeadersAndFooters.vdx", $saveFileFormat->VDX); print "Done with headers and footers." . 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) { # Call the diagram constructor to load diagram from a VSD file $diagram = new Diagram($dataDir . "drawing.vsd"); # Save as Html $saveFileFormat = new SaveFileFormat(); $diagram->save($dataDir . "Diagram.html", $saveFileFormat->HTML); print "Exported visio diagram to HTML." . PHP_EOL; }
public static function run($dataDir = null) { # Create instance of Diagram $diagram = new Diagram(); # Save as VDX $saveFileFormat = new SaveFileFormat(); $diagram->save($dataDir . "CreateDiagram.vdx", $saveFileFormat->VDX); print "Created visio diagram successfully!" . PHP_EOL; }
public static function export_to_vtx($dataDir = null) { # Call the diagram constructor to load diagram from a VSD file $diagram = new Diagram($dataDir . "drawing.vsd"); # Save as VTX $saveFileFormat = new SaveFileFormat(); $diagram->save($dataDir . "Diagram.vtx", $saveFileFormat->VTX); print "Exported visio diagram to VTX." . 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) { # Create instance of Diagram $diagram = new Diagram($dataDir . "drawing.vsd"); # remove all macros $diagram->setVbProjectData(null); # Save as VDX $saveFileFormat = new SaveFileFormat(); $diagram->save($dataDir . "RemoveAllMacros.vdx", $saveFileFormat->VDX); print "Removed all macros from diagram successfully!" . 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"); $diagram->getDocumentSettings()->setProtectBkgnds(1); $diagram->getDocumentSettings()->setProtectMasters(1); $diagram->getDocumentSettings()->setProtectShapes(1); $diagram->getDocumentSettings()->setProtectStyles(1); # Save diagram $saveFileFormat = new SaveFileFormat(); $diagram->save($dataDir . "ProtectUnprotectDiagram.vdx", $saveFileFormat->VDX); print "Applied protection on diagram successfully!" . PHP_EOL; }
public static function run($dataDir = null) { # Create instance of Diagram $diagram = new Diagram($dataDir . "Drawing.vsd"); # get window object by index $window = $diagram->getWindows()->get(0); # check dynamic grid option $window->setDynamicGridEnabled(1); # check connection points option $window->setShowConnectionPoints(1); # Save as VDX $saveFileFormat = new SaveFileFormat(); $diagram->save($dataDir . "AddDynamicGridsAndConnectionPoints.vsx", $saveFileFormat->VSX); print "Added Support of Dynamic Grids and Connection Points in the Visio Drawings." . PHP_EOL; }
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"); # 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.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"); # initialize SolutionXML object $solution_xml = new SolutionXML(); # set name $solution_xml->setName("Solution XML"); # set xml value $solution_xml->setXmlValue("XML Value"); # add SolutionXML element $diagram->getSolutionXMLs()->add($solution_xml); # save Visio diagram $saveFileFormat = new SaveFileFormat(); $diagram->save($dataDir . "SolutionXmlElement.vdx", $saveFileFormat->VDX); print "Added SolutionXML Element to the Visio Drawing." . 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"); # get window object by index $window = $diagram->getWindows()->get(0); # set visibility of grid $window->setShowGrid(1); # set visibility of guides $window->setShowGuides(1); # set visibility of rulers $window->setShowRulers(1); # set visibility of page breaks $window->setShowPageBreaks(1); # save in any supported format $saveFileFormat = new SaveFileFormat(); $diagram->save($dataDir . "ShowHideProperties.vdx", $saveFileFormat->VDX); print "Show and Hide Grids, Rulers, Guides and Page Breaks of the Visio Diagram." . 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 < 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"); $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"); $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(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"); # 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; }