Set Visio Shape's XForm Data in Ruby

Aspose.Diagram - Set Visio Shape’s XForm Data

To Set Visio Shape’s XForm Data using Aspose.Diagram Java for Ruby, simply invoke SetShapeXFormData module. Here you can see example code.

Ruby Code

 data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'

\# Create instance of Diagram

diagram = Rjb::import('com.aspose.diagram.Diagram').new(data_dir + "Drawing.vsd")

shapes = diagram.getPages().getPage(0).getShapes()

i = 0

while i < shapes.getCount()

    shape = shapes.get(i)

    if shape.getNameU() == "process" && shape.getID() == 1

        shape.getXForm().getPinX().setValue(5)

        shape.getXForm().getPinY().setValue(5)

    end

    i +=1

end

\# Save diagram

diagram.save(data_dir + "SetShapeXFormData.vdx", Rjb::import('com.aspose.diagram.SaveFileFormat').VDX)

puts "Set visio shape's XForm data."

Download Running Code

Download Set Visio Shape’s XForm Data (Aspose.Diagram) from any of the below mentioned social coding sites: