asposediagramjava 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +3 -0
  3. data/LICENSE +21 -0
  4. data/README.md +43 -0
  5. data/Rakefile +2 -0
  6. data/asposediagramjava.gemspec +27 -0
  7. data/config/aspose.yml +5 -0
  8. data/data/Basic_Shapes.vsd +0 -0
  9. data/data/Drawing.vdx +12 -0
  10. data/data/Drawing.vsd +0 -0
  11. data/data/Hyperlinks.vdx +12 -0
  12. data/data/Layers.vdx +12 -0
  13. data/data/UserDefinedCells.vdx +12 -0
  14. data/data/star.png +0 -0
  15. data/lib/asposediagramjava.rb +71 -0
  16. data/lib/asposediagramjava/Diagrams/addcommenttodiagram.rb +18 -0
  17. data/lib/asposediagramjava/Diagrams/creatediagram.rb +15 -0
  18. data/lib/asposediagramjava/Diagrams/getconnectorsinfo.rb +22 -0
  19. data/lib/asposediagramjava/Diagrams/getdiagramfontinfo.rb +21 -0
  20. data/lib/asposediagramjava/Diagrams/removeallmacrosfromdiagram.rb +18 -0
  21. data/lib/asposediagramjava/Export/exporttohtml.rb +15 -0
  22. data/lib/asposediagramjava/Export/exporttoimage.rb +15 -0
  23. data/lib/asposediagramjava/Export/exporttopdf.rb +15 -0
  24. data/lib/asposediagramjava/Export/exporttosvg.rb +15 -0
  25. data/lib/asposediagramjava/Export/exporttoxaml.rb +15 -0
  26. data/lib/asposediagramjava/Export/exporttoxml.rb +50 -0
  27. data/lib/asposediagramjava/Export/exporttoxps.rb +15 -0
  28. data/lib/asposediagramjava/Geometry/shapegeometrysection.rb +52 -0
  29. data/lib/asposediagramjava/HeadersAndFooters/headersandfooters.rb +40 -0
  30. data/lib/asposediagramjava/Hyperlinks/addhyperlinktoshape.rb +33 -0
  31. data/lib/asposediagramjava/Hyperlinks/getshapehyperlinkdata.rb +25 -0
  32. data/lib/asposediagramjava/Layers/addnewlayer.rb +39 -0
  33. data/lib/asposediagramjava/Layers/configureshapewithlayers.rb +34 -0
  34. data/lib/asposediagramjava/Layers/getalllayers.rb +25 -0
  35. data/lib/asposediagramjava/Masters/checkpresenceofmaster.rb +38 -0
  36. data/lib/asposediagramjava/Masters/getmasterinfo.rb +21 -0
  37. data/lib/asposediagramjava/Masters/getmasterobject.rb +40 -0
  38. data/lib/asposediagramjava/Pages/addpage.rb +45 -0
  39. data/lib/asposediagramjava/Pages/getpageinfo.rb +15 -0
  40. data/lib/asposediagramjava/Pages/getpageobject.rb +38 -0
  41. data/lib/asposediagramjava/Protection/protectunprotectdiagram.rb +20 -0
  42. data/lib/asposediagramjava/Protection/protectunprotectshape.rb +39 -0
  43. data/lib/asposediagramjava/Shapes/changeshapeposition.rb +26 -0
  44. data/lib/asposediagramjava/Shapes/connectsubshapes.rb +34 -0
  45. data/lib/asposediagramjava/Shapes/extractimages.rb +28 -0
  46. data/lib/asposediagramjava/Shapes/getshapeicon.rb +27 -0
  47. data/lib/asposediagramjava/Shapes/getshapeinfo.rb +23 -0
  48. data/lib/asposediagramjava/Shapes/readshapedata.rb +55 -0
  49. data/lib/asposediagramjava/Shapes/replacepictureshape.rb +33 -0
  50. data/lib/asposediagramjava/Shapes/rotateshape.rb +18 -0
  51. data/lib/asposediagramjava/Shapes/selectrerouteoption.rb +24 -0
  52. data/lib/asposediagramjava/Shapes/setmilestoneshapeproperties.rb +32 -0
  53. data/lib/asposediagramjava/Shapes/setshapeappearance.rb +24 -0
  54. data/lib/asposediagramjava/Shapes/setshapefilldata.rb +27 -0
  55. data/lib/asposediagramjava/Shapes/setshapeheightandwidth.rb +27 -0
  56. data/lib/asposediagramjava/Shapes/setshapelinedata.rb +28 -0
  57. data/lib/asposediagramjava/Shapes/setshapexformdata.rb +27 -0
  58. data/lib/asposediagramjava/SolutionXML/addsolutionxmlelement.rb +27 -0
  59. data/lib/asposediagramjava/SolutionXML/readxmlvalues.rb +23 -0
  60. data/lib/asposediagramjava/Text/addshapetextandstyles.rb +61 -0
  61. data/lib/asposediagramjava/Text/applycustomstylesheet.rb +48 -0
  62. data/lib/asposediagramjava/Text/updateshapetext.rb +27 -0
  63. data/lib/asposediagramjava/UserDefinedCells/createuserdefinedcell.rb +38 -0
  64. data/lib/asposediagramjava/UserDefinedCells/getuserdefinedcells.rb +34 -0
  65. data/lib/asposediagramjava/UserDefinedCells/readuserdefinedcells.rb +28 -0
  66. data/lib/asposediagramjava/WindowElements/adddynamicgridsandconnectionpoints.rb +24 -0
  67. data/lib/asposediagramjava/WindowElements/addwindowelement.rb +33 -0
  68. data/lib/asposediagramjava/WindowElements/getwindowelements.rb +24 -0
  69. data/lib/asposediagramjava/WindowElements/showhideproperties.rb +30 -0
  70. data/lib/asposediagramjava/asposediagram.rb +14 -0
  71. data/lib/asposediagramjava/diagrams.rb +5 -0
  72. data/lib/asposediagramjava/export.rb +7 -0
  73. data/lib/asposediagramjava/geometry.rb +1 -0
  74. data/lib/asposediagramjava/headersandfooters.rb +1 -0
  75. data/lib/asposediagramjava/hyperlinks.rb +2 -0
  76. data/lib/asposediagramjava/layers.rb +3 -0
  77. data/lib/asposediagramjava/masters.rb +3 -0
  78. data/lib/asposediagramjava/pages.rb +3 -0
  79. data/lib/asposediagramjava/protection.rb +2 -0
  80. data/lib/asposediagramjava/shapes.rb +15 -0
  81. data/lib/asposediagramjava/solutionxml.rb +2 -0
  82. data/lib/asposediagramjava/text.rb +3 -0
  83. data/lib/asposediagramjava/userdefinedcells.rb +3 -0
  84. data/lib/asposediagramjava/version.rb +3 -0
  85. data/lib/asposediagramjava/windowelements.rb +4 -0
  86. data/samples/diagrams.rb +13 -0
  87. data/samples/export.rb +15 -0
  88. data/samples/geometry.rb +9 -0
  89. data/samples/headersandfooters.rb +9 -0
  90. data/samples/hyperlinks.rb +10 -0
  91. data/samples/layers.rb +11 -0
  92. data/samples/masters.rb +11 -0
  93. data/samples/pages.rb +11 -0
  94. data/samples/protection.rb +10 -0
  95. data/samples/shapes.rb +22 -0
  96. data/samples/solutionxml.rb +10 -0
  97. data/samples/text.rb +11 -0
  98. data/samples/userdefinedcells.rb +11 -0
  99. data/samples/windowelements.rb +12 -0
  100. metadata +199 -0
@@ -0,0 +1,27 @@
1
+ module Asposediagramjava
2
+ module SetShapeFillData
3
+ def initialize()
4
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
5
+
6
+ # Create instance of Diagram
7
+ diagram = Rjb::import('com.aspose.diagram.Diagram').new(data_dir + "Drawing.vsd")
8
+
9
+ shapes = diagram.getPages().getPage(0).getShapes()
10
+
11
+ i = 0
12
+ while i < shapes.getCount()
13
+ shape = shapes.get(i)
14
+ if shape.getNameU() == "rectangle" && shape.getID() == 1
15
+ shape.getFill().getFillBkgnd().setValue(diagram.getPages().getPage(0).getShapes().getShape(0).getFill().getFillBkgnd().getValue())
16
+ shape.getFill().getFillForegnd().setValue("#ebf8df")
17
+ end
18
+ i +=1
19
+ end
20
+
21
+ # Save diagram
22
+ diagram.save(data_dir + "SetShapeFillData.vdx", Rjb::import('com.aspose.diagram.SaveFileFormat').VDX)
23
+
24
+ puts "Set visio shape's fill data."
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,27 @@
1
+ module Asposediagramjava
2
+ module SetShapeHeightAndWidth
3
+ def initialize()
4
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
5
+
6
+ # Create instance of Diagram
7
+ diagram = Rjb::import('com.aspose.diagram.Diagram').new(data_dir + "Drawing.vsd")
8
+
9
+ shapes = diagram.getPages().getPage(0).getShapes()
10
+
11
+ i = 0
12
+ while i < shapes.getCount()
13
+ shape = shapes.get(i)
14
+ if shape.getNameU() == "Process" && shape.getID() == 1
15
+ shape.setWidth(2 * shape.getXForm().getWidth().getValue())
16
+ shape.setHeight(2 * shape.getXForm().getHeight().getValue())
17
+ end
18
+ i +=1
19
+ end
20
+
21
+ # Save diagram
22
+ diagram.save(data_dir + "SetShapeHeightAndWidth.vdx", Rjb::import('com.aspose.diagram.SaveFileFormat').VDX)
23
+
24
+ puts "Set height and width of shape."
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,28 @@
1
+ module Asposediagramjava
2
+ module SetShapeLineData
3
+ def initialize()
4
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
5
+
6
+ # Create instance of Diagram
7
+ diagram = Rjb::import('com.aspose.diagram.Diagram').new(data_dir + "Drawing.vsd")
8
+
9
+ shapes = diagram.getPages().getPage(0).getShapes()
10
+
11
+ i = 0
12
+ while i < shapes.getCount()
13
+ shape = shapes.get(i)
14
+ if shape.getNameU() == "rectangle" && shape.getID() == 1
15
+ shape.getLine().getLineColor().setValue(diagram.getPages().getPage(0).getShapes().getShape(1).getFill().getFillForegnd().getValue())
16
+ shape.getLine().getLineWeight().setValue(0.07041666666666667)
17
+ shape.getLine().getRounding().setValue(0.1)
18
+ end
19
+ i +=1
20
+ end
21
+
22
+ # Save diagram
23
+ diagram.save(data_dir + "SetShapeLineData.vdx", Rjb::import('com.aspose.diagram.SaveFileFormat').VDX)
24
+
25
+ puts "Set visio shape's line data."
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,27 @@
1
+ module Asposediagramjava
2
+ module SetShapeXFormData
3
+ def initialize()
4
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
5
+
6
+ # Create instance of Diagram
7
+ diagram = Rjb::import('com.aspose.diagram.Diagram').new(data_dir + "Drawing.vsd")
8
+
9
+ shapes = diagram.getPages().getPage(0).getShapes()
10
+
11
+ i = 0
12
+ while i < shapes.getCount()
13
+ shape = shapes.get(i)
14
+ if shape.getNameU() == "process" && shape.getID() == 1
15
+ shape.getXForm().getPinX().setValue(5)
16
+ shape.getXForm().getPinY().setValue(5)
17
+ end
18
+ i +=1
19
+ end
20
+
21
+ # Save diagram
22
+ diagram.save(data_dir + "SetShapeXFormData.vdx", Rjb::import('com.aspose.diagram.SaveFileFormat').VDX)
23
+
24
+ puts "Set visio shape's XForm data."
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,27 @@
1
+ module Asposediagramjava
2
+ module AddSolutionXmlElement
3
+ def initialize()
4
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
5
+
6
+ # Create instance of Diagram
7
+ diagram = Rjb::import('com.aspose.diagram.Diagram').new(data_dir + "Drawing.vsd")
8
+
9
+ # initialize SolutionXML object
10
+ solution_xml = Rjb::import('com.aspose.diagram.SolutionXML').new
11
+
12
+ # set name
13
+ solution_xml.setName("Solution XML")
14
+
15
+ # set xml value
16
+ solution_xml.setXmlValue("XML Value")
17
+
18
+ # add SolutionXML element
19
+ diagram.getSolutionXMLs().add(solution_xml)
20
+
21
+ # save Visio diagram
22
+ diagram.save(data_dir + "SolutionXmlElement.vdx", Rjb::import('com.aspose.diagram.SaveFileFormat').VDX)
23
+
24
+ puts "Added SolutionXML Element to the Visio Drawing."
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,23 @@
1
+ module Asposediagramjava
2
+ module ReadXmlValues
3
+ def initialize()
4
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
5
+
6
+ # Create instance of Diagram
7
+ diagram = Rjb::import('com.aspose.diagram.Diagram').new(data_dir + "SolutionXmlElement.vdx")
8
+
9
+ solution_xmls = diagram.getSolutionXMLs()
10
+
11
+ i = 0
12
+ while i < solution_xmls.getCount()
13
+ solution_xml = solution_xmls.get(i)
14
+ # get name property
15
+ puts "Name: " + solution_xml.getName().to_s
16
+ # get xml value
17
+ puts "Value:" + solution_xml.getXmlValue().to_s
18
+
19
+ i +=1
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,61 @@
1
+ module Asposediagramjava
2
+ module AddShapeTextAndStyles
3
+ def initialize()
4
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
5
+
6
+ # Create instance of Diagram
7
+ diagram = Rjb::import('com.aspose.diagram.Diagram').new(data_dir + "Drawing.vsd")
8
+
9
+ # Get a particular shape
10
+ shape = diagram.getPages().getPage("Flow 1").getShapes().getShape(1)
11
+
12
+ # Clear shape text values and chars
13
+ shape.getText().getValue().clear()
14
+ shape.getChars().clear()
15
+
16
+ # Mark character run and add text
17
+ shape.getText().getValue().add(Rjb::import('com.aspose.diagram.Cp').new(0))
18
+ shape.getText().getValue().add(Rjb::import('com.aspose.diagram.Txt').new("TextStyle_Regular"))
19
+ shape.getText().getValue().add(Rjb::import('com.aspose.diagram.Cp').new(1))
20
+ shape.getText().getValue().add(Rjb::import('com.aspose.diagram.Txt').new("TextStyle_Bold_Italic"))
21
+ shape.getText().getValue().add(Rjb::import('com.aspose.diagram.Cp').new(2))
22
+ shape.getText().getValue().add(Rjb::import('com.aspose.diagram.Txt').new("TextStyle_Underline_Italic"))
23
+ shape.getText().getValue().add(Rjb::import('com.aspose.diagram.Cp').new(3))
24
+ shape.getText().getValue().add(Rjb::import('com.aspose.diagram.Txt').new("TextStyle_Bold_Italic_Underline"))
25
+
26
+ # Add formatting characters
27
+ shape.getChars().add(Rjb::import('com.aspose.diagram.Char').new)
28
+ shape.getChars().add(Rjb::import('com.aspose.diagram.Char').new)
29
+ shape.getChars().add(Rjb::import('com.aspose.diagram.Char').new)
30
+ shape.getChars().add(Rjb::import('com.aspose.diagram.Char').new)
31
+
32
+ style_value = Rjb::import('com.aspose.diagram.StyleValue')
33
+
34
+ # Set properties e.g. color, font, size and style etc.
35
+ shape.getChars().getChar(0).setIX(0)
36
+ shape.getChars().getChar(0).getColor().setValue("#FF0000")
37
+ shape.getChars().getChar(0).getFont().setValue(4)
38
+ shape.getChars().getChar(0).getSize().setValue(0.22)
39
+ shape.getChars().getChar(0).getStyle().setValue(style_value.UNDEFINED)
40
+
41
+ # Set properties e.g. color, font, size and style etc.
42
+ shape.getChars().getChar(1).setIX(1)
43
+ shape.getChars().getChar(1).getColor().setValue("#FF00FF")
44
+ shape.getChars().getChar(1).getFont().setValue(4)
45
+ shape.getChars().getChar(1).getSize().setValue(0.22)
46
+ shape.getChars().getChar(1).getStyle().setValue(style_value.BOLD | style_value.ITALIC)
47
+
48
+ # Set properties e.g. color, font, size and style etc.
49
+ shape.getChars().getChar(2).setIX(2)
50
+ shape.getChars().getChar(2).getColor().setValue("#00FF00")
51
+ shape.getChars().getChar(2).getFont().setValue(4)
52
+ shape.getChars().getChar(2).getSize().setValue(0.22)
53
+ shape.getChars().getChar(2).getStyle().setValue(style_value.UNDERLINE | style_value.ITALIC)
54
+
55
+ # Save diagram
56
+ diagram.save(data_dir + "AddShapeTextAndStyles.vdx", Rjb::import('com.aspose.diagram.SaveFileFormat').VDX)
57
+
58
+ puts "Added shape text and styles."
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,48 @@
1
+ module Asposediagramjava
2
+ module ApplyCustomStyleSheet
3
+ def initialize()
4
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
5
+
6
+ # Create instance of Diagram
7
+ diagram = Rjb::import('com.aspose.diagram.Diagram').new(data_dir + "Drawing.vsd")
8
+
9
+ shapes = diagram.getPages().getPage(0).getShapes()
10
+
11
+ i = 0
12
+ while i < shapes.getCount()
13
+ shape = shapes.get(i)
14
+ if shape.getNameU() == "Process"
15
+ source_shape = shape
16
+ break
17
+ end
18
+ i +=1
19
+ end
20
+
21
+ # Find the required style sheet
22
+ stylesheets = diagram.getStyleSheets()
23
+ j = 0
24
+ while j < stylesheets.getCount()
25
+ stylesheet = stylesheets.get(j)
26
+ if stylesheet.getName() == "Basic"
27
+ custom_stylesheet = stylesheet
28
+ break
29
+ end
30
+ j +=1
31
+ end
32
+
33
+ if source_shape != nil && custom_stylesheet != nil
34
+ # Apply text style
35
+ source_shape.setTextStyle(custom_stylesheet)
36
+ # Apply fill style
37
+ source_shape.setFillStyle(custom_stylesheet)
38
+ # Apply line style
39
+ source_shape.setLineStyle(custom_stylesheet)
40
+ end
41
+
42
+ # Save diagram
43
+ diagram.save(data_dir + "ApplyCustomStyleSheet.vdx", Rjb::import('com.aspose.diagram.SaveFileFormat').VDX)
44
+
45
+ puts "Applied custom stylesheet to a visio diagram."
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,27 @@
1
+ module Asposediagramjava
2
+ module UpdateShapeText
3
+ def initialize()
4
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
5
+
6
+ # Create instance of Diagram
7
+ diagram = Rjb::import('com.aspose.diagram.Diagram').new(data_dir + "Drawing.vsd")
8
+
9
+ shapes = diagram.getPages().getPage(0).getShapes()
10
+
11
+ i = 0
12
+ while i < shapes.getCount()
13
+ shape = shapes.get(i)
14
+ if shape.getNameU() == "Process" && shape.getID() == 1
15
+ shape.getText().getValue().clear()
16
+ shape.getText().getValue().add(Rjb::import('com.aspose.diagram.Txt').new("New Text"))
17
+ end
18
+ i +=1
19
+ end
20
+
21
+ # Save diagram
22
+ diagram.save(data_dir + "UpdateShapeText.vdx", Rjb::import('com.aspose.diagram.SaveFileFormat').VDX)
23
+
24
+ puts "Updated shape text."
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,38 @@
1
+ module Asposediagramjava
2
+ module CreateUserDefinedCell
3
+ def initialize()
4
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
5
+
6
+ # Create instance of Diagram
7
+ diagram = Rjb::import('com.aspose.diagram.Diagram').new(data_dir + "Drawing.vsd")
8
+
9
+ pages = diagram.getPages()
10
+
11
+ i = 0
12
+ while i < pages.getCount()
13
+ page = pages.get(i)
14
+ shapes = page.getShapes()
15
+ j = 0
16
+ while j < shapes.getCount()
17
+ shape = shapes.get(j)
18
+ if shape.getNameU() == "Process"
19
+ # Initialize user object
20
+ user = Rjb::import('com.aspose.diagram.User').new
21
+ user.setName("UserDefineCell")
22
+ user.getValue().setVal("800")
23
+
24
+ # Add user-defined cell
25
+ shape.getUsers().add(user)
26
+ end
27
+ j +=1
28
+ end
29
+ i +=1
30
+ end
31
+
32
+ # Save diagram
33
+ diagram.save(data_dir + "UserDefinedCells.vdx", Rjb::import('com.aspose.diagram.SaveFileFormat').VDX)
34
+
35
+ puts "Created User-defined Cell in the ShapeSheet."
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,34 @@
1
+ module Asposediagramjava
2
+ module GetUserDefinedCells
3
+ def initialize()
4
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
5
+
6
+ # Create instance of Diagram
7
+ diagram = Rjb::import('com.aspose.diagram.Diagram').new(data_dir + "UserDefinedCells.vdx")
8
+
9
+ pages = diagram.getPages()
10
+
11
+ count = 0
12
+ while count < pages.getCount()
13
+ page = pages.get(count)
14
+ shapes = page.getShapes()
15
+ i = 0
16
+ while i < shapes.getCount()
17
+ shape = shapes.get(i)
18
+ if shape.getNameU() == "Process"
19
+ users = shape.getUsers()
20
+ j = 0
21
+ while j < users.getCount()
22
+ user = users.get(j)
23
+ puts "Name: " + user.getNameU() + " Value: " + user.getValue().getVal() + " Prompt: " + user.getPrompt().getValue()
24
+ j +=1
25
+ end
26
+ break
27
+ end
28
+ i +=1
29
+ end
30
+ count +=1
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,28 @@
1
+ module Asposediagramjava
2
+ module ReadUserDefinedCells
3
+ def initialize()
4
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
5
+
6
+ # Create instance of Diagram
7
+ diagram = Rjb::import('com.aspose.diagram.Diagram').new(data_dir + "UserDefinedCells.vdx")
8
+
9
+ shapes = diagram.getPages().getPage("Flow 1").getShapes()
10
+
11
+ i = 0
12
+ while i < shapes.getCount()
13
+ shape = shapes.get(i)
14
+ if shape.getNameU() == "Process"
15
+ users = shape.getUsers()
16
+ j = 0
17
+ while j < users.getCount()
18
+ user = users.get(j)
19
+ puts user.getName() + ": " + user.getValue().getVal()
20
+ j +=1
21
+ end
22
+ break
23
+ end
24
+ i +=1
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,24 @@
1
+ module Asposediagramjava
2
+ module AddDynamicGridsAndConnectionPoints
3
+ def initialize()
4
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
5
+
6
+ # Create instance of Diagram
7
+ diagram = Rjb::import('com.aspose.diagram.Diagram').new(data_dir + "Drawing.vsd")
8
+
9
+ # get window object by index
10
+ window = diagram.getWindows().get(0)
11
+
12
+ # check dynamic grid option
13
+ window.setDynamicGridEnabled(1)
14
+
15
+ # check connection points option
16
+ window.setShowConnectionPoints(1)
17
+
18
+ # Save as VDX
19
+ diagram.save(data_dir + "AddDynamicGridsAndConnectionPoints.vsx", Rjb::import('com.aspose.diagram.SaveFileFormat').VSX)
20
+
21
+ puts "Added Support of Dynamic Grids and Connection Points in the Visio Drawings."
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,33 @@
1
+ module Asposediagramjava
2
+ module AddWindowElement
3
+ def initialize()
4
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
5
+
6
+ # Create instance of Diagram
7
+ diagram = Rjb::import('com.aspose.diagram.Diagram').new(data_dir + "Drawing.vsd")
8
+
9
+ # initialize window object
10
+ window = Rjb::import('com.aspose.diagram.Window').new
11
+
12
+ # set window state
13
+ window.setWindowState(Rjb::import('com.aspose.diagram.WindowStateValue').MAXIMIZED)
14
+
15
+ # set window height
16
+ window.setWindowHeight(500)
17
+
18
+ # set window width
19
+ window.setWindowWidth(500)
20
+
21
+ # set window type
22
+ window.setWindowType(Rjb::import('com.aspose.diagram.WindowTypeValue').STENCIL)
23
+
24
+ # add window object
25
+ diagram.getWindows().add(window)
26
+
27
+ # save in any supported format
28
+ diagram.save(data_dir + "AddWindowElement.vdx", Rjb::import('com.aspose.diagram.SaveFileFormat').VDX)
29
+
30
+ puts "Added window element to the visio instance."
31
+ end
32
+ end
33
+ end