asposediagramjava 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +3 -0
- data/LICENSE +21 -0
- data/README.md +43 -0
- data/Rakefile +2 -0
- data/asposediagramjava.gemspec +27 -0
- data/config/aspose.yml +5 -0
- data/data/Basic_Shapes.vsd +0 -0
- data/data/Drawing.vdx +12 -0
- data/data/Drawing.vsd +0 -0
- data/data/Hyperlinks.vdx +12 -0
- data/data/Layers.vdx +12 -0
- data/data/UserDefinedCells.vdx +12 -0
- data/data/star.png +0 -0
- data/lib/asposediagramjava.rb +71 -0
- data/lib/asposediagramjava/Diagrams/addcommenttodiagram.rb +18 -0
- data/lib/asposediagramjava/Diagrams/creatediagram.rb +15 -0
- data/lib/asposediagramjava/Diagrams/getconnectorsinfo.rb +22 -0
- data/lib/asposediagramjava/Diagrams/getdiagramfontinfo.rb +21 -0
- data/lib/asposediagramjava/Diagrams/removeallmacrosfromdiagram.rb +18 -0
- data/lib/asposediagramjava/Export/exporttohtml.rb +15 -0
- data/lib/asposediagramjava/Export/exporttoimage.rb +15 -0
- data/lib/asposediagramjava/Export/exporttopdf.rb +15 -0
- data/lib/asposediagramjava/Export/exporttosvg.rb +15 -0
- data/lib/asposediagramjava/Export/exporttoxaml.rb +15 -0
- data/lib/asposediagramjava/Export/exporttoxml.rb +50 -0
- data/lib/asposediagramjava/Export/exporttoxps.rb +15 -0
- data/lib/asposediagramjava/Geometry/shapegeometrysection.rb +52 -0
- data/lib/asposediagramjava/HeadersAndFooters/headersandfooters.rb +40 -0
- data/lib/asposediagramjava/Hyperlinks/addhyperlinktoshape.rb +33 -0
- data/lib/asposediagramjava/Hyperlinks/getshapehyperlinkdata.rb +25 -0
- data/lib/asposediagramjava/Layers/addnewlayer.rb +39 -0
- data/lib/asposediagramjava/Layers/configureshapewithlayers.rb +34 -0
- data/lib/asposediagramjava/Layers/getalllayers.rb +25 -0
- data/lib/asposediagramjava/Masters/checkpresenceofmaster.rb +38 -0
- data/lib/asposediagramjava/Masters/getmasterinfo.rb +21 -0
- data/lib/asposediagramjava/Masters/getmasterobject.rb +40 -0
- data/lib/asposediagramjava/Pages/addpage.rb +45 -0
- data/lib/asposediagramjava/Pages/getpageinfo.rb +15 -0
- data/lib/asposediagramjava/Pages/getpageobject.rb +38 -0
- data/lib/asposediagramjava/Protection/protectunprotectdiagram.rb +20 -0
- data/lib/asposediagramjava/Protection/protectunprotectshape.rb +39 -0
- data/lib/asposediagramjava/Shapes/changeshapeposition.rb +26 -0
- data/lib/asposediagramjava/Shapes/connectsubshapes.rb +34 -0
- data/lib/asposediagramjava/Shapes/extractimages.rb +28 -0
- data/lib/asposediagramjava/Shapes/getshapeicon.rb +27 -0
- data/lib/asposediagramjava/Shapes/getshapeinfo.rb +23 -0
- data/lib/asposediagramjava/Shapes/readshapedata.rb +55 -0
- data/lib/asposediagramjava/Shapes/replacepictureshape.rb +33 -0
- data/lib/asposediagramjava/Shapes/rotateshape.rb +18 -0
- data/lib/asposediagramjava/Shapes/selectrerouteoption.rb +24 -0
- data/lib/asposediagramjava/Shapes/setmilestoneshapeproperties.rb +32 -0
- data/lib/asposediagramjava/Shapes/setshapeappearance.rb +24 -0
- data/lib/asposediagramjava/Shapes/setshapefilldata.rb +27 -0
- data/lib/asposediagramjava/Shapes/setshapeheightandwidth.rb +27 -0
- data/lib/asposediagramjava/Shapes/setshapelinedata.rb +28 -0
- data/lib/asposediagramjava/Shapes/setshapexformdata.rb +27 -0
- data/lib/asposediagramjava/SolutionXML/addsolutionxmlelement.rb +27 -0
- data/lib/asposediagramjava/SolutionXML/readxmlvalues.rb +23 -0
- data/lib/asposediagramjava/Text/addshapetextandstyles.rb +61 -0
- data/lib/asposediagramjava/Text/applycustomstylesheet.rb +48 -0
- data/lib/asposediagramjava/Text/updateshapetext.rb +27 -0
- data/lib/asposediagramjava/UserDefinedCells/createuserdefinedcell.rb +38 -0
- data/lib/asposediagramjava/UserDefinedCells/getuserdefinedcells.rb +34 -0
- data/lib/asposediagramjava/UserDefinedCells/readuserdefinedcells.rb +28 -0
- data/lib/asposediagramjava/WindowElements/adddynamicgridsandconnectionpoints.rb +24 -0
- data/lib/asposediagramjava/WindowElements/addwindowelement.rb +33 -0
- data/lib/asposediagramjava/WindowElements/getwindowelements.rb +24 -0
- data/lib/asposediagramjava/WindowElements/showhideproperties.rb +30 -0
- data/lib/asposediagramjava/asposediagram.rb +14 -0
- data/lib/asposediagramjava/diagrams.rb +5 -0
- data/lib/asposediagramjava/export.rb +7 -0
- data/lib/asposediagramjava/geometry.rb +1 -0
- data/lib/asposediagramjava/headersandfooters.rb +1 -0
- data/lib/asposediagramjava/hyperlinks.rb +2 -0
- data/lib/asposediagramjava/layers.rb +3 -0
- data/lib/asposediagramjava/masters.rb +3 -0
- data/lib/asposediagramjava/pages.rb +3 -0
- data/lib/asposediagramjava/protection.rb +2 -0
- data/lib/asposediagramjava/shapes.rb +15 -0
- data/lib/asposediagramjava/solutionxml.rb +2 -0
- data/lib/asposediagramjava/text.rb +3 -0
- data/lib/asposediagramjava/userdefinedcells.rb +3 -0
- data/lib/asposediagramjava/version.rb +3 -0
- data/lib/asposediagramjava/windowelements.rb +4 -0
- data/samples/diagrams.rb +13 -0
- data/samples/export.rb +15 -0
- data/samples/geometry.rb +9 -0
- data/samples/headersandfooters.rb +9 -0
- data/samples/hyperlinks.rb +10 -0
- data/samples/layers.rb +11 -0
- data/samples/masters.rb +11 -0
- data/samples/pages.rb +11 -0
- data/samples/protection.rb +10 -0
- data/samples/shapes.rb +22 -0
- data/samples/solutionxml.rb +10 -0
- data/samples/text.rb +11 -0
- data/samples/userdefinedcells.rb +11 -0
- data/samples/windowelements.rb +12 -0
- metadata +199 -0
@@ -0,0 +1,15 @@
|
|
1
|
+
module Asposediagramjava
|
2
|
+
module GetPageInfo
|
3
|
+
def initialize()
|
4
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
5
|
+
|
6
|
+
# Call the diagram constructor to load diagram from a VSD file
|
7
|
+
diagram = Rjb::import('com.aspose.diagram.Diagram').new(data_dir + "Drawing.vsd")
|
8
|
+
|
9
|
+
#page = diagram.getPages().getPage(page_id)
|
10
|
+
page = diagram.getPages().getPage(0)
|
11
|
+
|
12
|
+
puts "Page ID : " + page.getName().to_s
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Asposediagramjava
|
2
|
+
module GetPageObject
|
3
|
+
def initialize()
|
4
|
+
# Getting a Page Object by ID
|
5
|
+
get_page_object_by_id()
|
6
|
+
|
7
|
+
# Getting a Page Object by Name
|
8
|
+
get_page_object_by_name()
|
9
|
+
end
|
10
|
+
|
11
|
+
def get_page_object_by_id()
|
12
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
13
|
+
|
14
|
+
# Call the diagram constructor to load diagram from a VSD file
|
15
|
+
diagram = Rjb::import('com.aspose.diagram.Diagram').new(data_dir + "Drawing.vsd")
|
16
|
+
|
17
|
+
page_id = 0
|
18
|
+
# Get page object by id
|
19
|
+
page = diagram.getPages().getPage(page_id)
|
20
|
+
|
21
|
+
puts "Page : " + page.to_string
|
22
|
+
end
|
23
|
+
|
24
|
+
def get_page_object_by_name()
|
25
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
26
|
+
|
27
|
+
# Call the diagram constructor to load diagram from a VSD file
|
28
|
+
diagram = Rjb::import('com.aspose.diagram.Diagram').new(data_dir + "Drawing.vsd")
|
29
|
+
|
30
|
+
# Set page name
|
31
|
+
page_name = "Flow 1"
|
32
|
+
# Get page object by name
|
33
|
+
page = diagram.getPages().getPage(page_name)
|
34
|
+
|
35
|
+
puts "Page : " + page.to_string
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Asposediagramjava
|
2
|
+
module ProtectUnprotectDiagram
|
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
|
+
diagram.getDocumentSettings().setProtectBkgnds(1)
|
10
|
+
diagram.getDocumentSettings().setProtectMasters(1)
|
11
|
+
diagram.getDocumentSettings().setProtectShapes(1)
|
12
|
+
diagram.getDocumentSettings().setProtectStyles(1)
|
13
|
+
|
14
|
+
# Save diagram
|
15
|
+
diagram.save(data_dir + "ProtectUnprotectDiagram.vdx", Rjb::import('com.aspose.diagram.SaveFileFormat').VDX)
|
16
|
+
|
17
|
+
puts "Applied protection on diagram successfully!"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Asposediagramjava
|
2
|
+
module ProtectUnprotectShape
|
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
|
+
page = diagram.getPages().getPage("Flow 1")
|
10
|
+
|
11
|
+
shape = page.getShapes().getShape(1)
|
12
|
+
shape.getProtection().getLockAspect().setValue(1)
|
13
|
+
shape.getProtection().getLockBegin().setValue(1)
|
14
|
+
shape.getProtection().getLockCalcWH().setValue(1)
|
15
|
+
shape.getProtection().getLockCrop().setValue(1)
|
16
|
+
shape.getProtection().getLockCustProp().setValue(1)
|
17
|
+
shape.getProtection().getLockDelete().setValue(1)
|
18
|
+
shape.getProtection().getLockEnd().setValue(1)
|
19
|
+
shape.getProtection().getLockFormat().setValue(1)
|
20
|
+
shape.getProtection().getLockFromGroupFormat().setValue(1)
|
21
|
+
shape.getProtection().getLockGroup().setValue(1)
|
22
|
+
shape.getProtection().getLockHeight().setValue(1)
|
23
|
+
shape.getProtection().getLockMoveX().setValue(1)
|
24
|
+
shape.getProtection().getLockMoveY().setValue(1)
|
25
|
+
shape.getProtection().getLockRotate().setValue(1)
|
26
|
+
shape.getProtection().getLockSelect().setValue(1)
|
27
|
+
shape.getProtection().getLockTextEdit().setValue(1)
|
28
|
+
shape.getProtection().getLockThemeColors().setValue(1)
|
29
|
+
shape.getProtection().getLockThemeEffects().setValue(1)
|
30
|
+
shape.getProtection().getLockVtxEdit().setValue(1)
|
31
|
+
shape.getProtection().getLockWidth().setValue(1)
|
32
|
+
|
33
|
+
# Save diagram
|
34
|
+
diagram.save(data_dir + "ProtectUnprotectShape.vdx", Rjb::import('com.aspose.diagram.SaveFileFormat').VDX)
|
35
|
+
|
36
|
+
puts "Applied protection on shape successfully!"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Asposediagramjava
|
2
|
+
module ChangeShapePosition
|
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() == 2
|
15
|
+
shape.move(1, 1)
|
16
|
+
end
|
17
|
+
i +=1
|
18
|
+
end
|
19
|
+
|
20
|
+
# Save diagram
|
21
|
+
diagram.save(data_dir + "ChangeShapePosition.vdx", Rjb::import('com.aspose.diagram.SaveFileFormat').VDX)
|
22
|
+
|
23
|
+
puts "Changed postion of a shape."
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Asposediagramjava
|
2
|
+
module ConnectSubShapes
|
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
|
+
# Access a particular page
|
10
|
+
page = diagram.getPages().getPage("Flow 1")
|
11
|
+
|
12
|
+
# Set sub shape ids
|
13
|
+
shape_from_id = 1
|
14
|
+
shape_to_id = 9
|
15
|
+
|
16
|
+
# Initialize connector shape
|
17
|
+
shape = Rjb::import('com.aspose.diagram.Shape').new
|
18
|
+
shape.getLine().getEndArrow().setValue(5)
|
19
|
+
shape.getLine().getLineWeight().setValue(0.01388)
|
20
|
+
|
21
|
+
# Add shape
|
22
|
+
connecter_id = diagram.addShape(shape, "Dynamic connector", page.getID())
|
23
|
+
|
24
|
+
# Connect sub-shapes
|
25
|
+
connection_point_place = Rjb::import('com.aspose.diagram.ConnectionPointPlace')
|
26
|
+
page.connectShapesViaConnector(shape_from_id, connection_point_place.RIGHT, shape_to_id, connection_point_place.LEFT, connecter_id)
|
27
|
+
|
28
|
+
# Save diagram
|
29
|
+
diagram.save(data_dir + "ConnectSubShapes.vdx", Rjb::import('com.aspose.diagram.SaveFileFormat').VDX)
|
30
|
+
|
31
|
+
puts "Connected sub-shapes of a group."
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Asposediagramjava
|
2
|
+
module ExtractImages
|
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("Flow 1").getShapes()
|
10
|
+
|
11
|
+
i = 0
|
12
|
+
while i < shapes.getCount()
|
13
|
+
shape = shapes.get(i)
|
14
|
+
# Filter shapes by type Foreign
|
15
|
+
if shape.getType() == Rjb::import('com.aspose.diagram.TypeValue').FOREIGN
|
16
|
+
# create an image file
|
17
|
+
fos = Rjb::import('java.io.FileOutputStream').new(data_dir + "Image#{i}.bmp")
|
18
|
+
fos.write(shape.getForeignData().getValue())
|
19
|
+
fos.close()
|
20
|
+
end
|
21
|
+
|
22
|
+
i +=1
|
23
|
+
end
|
24
|
+
|
25
|
+
puts "Extracted images successfully!"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Asposediagramjava
|
2
|
+
module GetShapeIcon
|
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 + "Basic_Shapes.vsd")
|
8
|
+
|
9
|
+
# get master
|
10
|
+
master = diagram.getMasters().getMasterByName("Circle")
|
11
|
+
|
12
|
+
# get byte array
|
13
|
+
bytes = master.getIcon()
|
14
|
+
|
15
|
+
# create an image file
|
16
|
+
fos = Rjb::import('java.io.FileOutputStream').new(data_dir + "MyImage.png")
|
17
|
+
|
18
|
+
# write byte array of the image
|
19
|
+
fos.write(bytes)
|
20
|
+
|
21
|
+
# close array
|
22
|
+
fos.close()
|
23
|
+
|
24
|
+
puts "Get shape icon, please check the output file."
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Asposediagramjava
|
2
|
+
module GetShapeInfo
|
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
|
+
# Display information about the shapes
|
15
|
+
puts "Shape ID : " + shape.getID().to_s
|
16
|
+
puts "Name : " + shape.getName().to_s
|
17
|
+
puts "Master Shape : " + shape.getMaster().getName().to_s
|
18
|
+
|
19
|
+
i +=1
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module Asposediagramjava
|
2
|
+
module ReadShapeData
|
3
|
+
def initialize()
|
4
|
+
# Read All Shape Properties
|
5
|
+
read_all_shape_properties()
|
6
|
+
|
7
|
+
# Read a Shape Property by Name
|
8
|
+
read_shape_property_by_name()
|
9
|
+
end
|
10
|
+
|
11
|
+
def read_all_shape_properties()
|
12
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
13
|
+
|
14
|
+
# Create instance of Diagram
|
15
|
+
diagram = Rjb::import('com.aspose.diagram.Diagram').new(data_dir + "Drawing.vsd")
|
16
|
+
|
17
|
+
shapes = diagram.getPages().getPage(0).getShapes()
|
18
|
+
|
19
|
+
i = 0
|
20
|
+
while i < shapes.getCount()
|
21
|
+
shape = shapes.get(i)
|
22
|
+
if shape.getName() == "Process"
|
23
|
+
j = 0
|
24
|
+
while j < shape.getProps().getCount()
|
25
|
+
property = shape.getProps().get(j)
|
26
|
+
puts property.getLabel().getValue() + ": " + property.getValue().getVal()
|
27
|
+
j +=1
|
28
|
+
end
|
29
|
+
break
|
30
|
+
end
|
31
|
+
|
32
|
+
i +=1
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def read_shape_property_by_name()
|
37
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
38
|
+
|
39
|
+
# Create instance of Diagram
|
40
|
+
diagram = Rjb::import('com.aspose.diagram.Diagram').new(data_dir + "Drawing.vsd")
|
41
|
+
|
42
|
+
shapes = diagram.getPages().getPage(0).getShapes()
|
43
|
+
|
44
|
+
i = 0
|
45
|
+
while i < shapes.getCount()
|
46
|
+
shape = shapes.get(i)
|
47
|
+
if shape.getName() == "Process"
|
48
|
+
property = shape.getProps().getProp("Cost")
|
49
|
+
puts property.getLabel().getValue() + ": " + property.getValue().getVal()
|
50
|
+
end
|
51
|
+
i +=1
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Asposediagramjava
|
2
|
+
module ReplacePictureShape
|
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
|
+
# convert image into bytes array
|
10
|
+
fi = Rjb::import('java.io.File').new(data_dir + "star.png")
|
11
|
+
file_content = Rjb::import('java.nio.file.Files').readAllBytes(fi.toPath())
|
12
|
+
|
13
|
+
shapes = diagram.getPages().getPage("Flow 1").getShapes()
|
14
|
+
|
15
|
+
i = 0
|
16
|
+
while i < shapes.getCount()
|
17
|
+
shape = shapes.get(i)
|
18
|
+
# Filter shapes by type Foreign
|
19
|
+
if shape.getType() == Rjb::import('com.aspose.diagram.TypeValue').FOREIGN
|
20
|
+
# replace picture shape
|
21
|
+
shape.getForeignData().setValue(file_content)
|
22
|
+
end
|
23
|
+
|
24
|
+
i +=1
|
25
|
+
end
|
26
|
+
|
27
|
+
# Save diagram
|
28
|
+
diagram.save(data_dir + "ReplacePictureShape.vdx", Rjb::import('com.aspose.diagram.SaveFileFormat').VDX)
|
29
|
+
|
30
|
+
puts "Replaced picture shape successfully!"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Asposediagramjava
|
2
|
+
module RotateShape
|
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
|
+
# Add a shape and set the angle
|
10
|
+
diagram.getPages().getPage(0).getShapes().getShape(1).setAngle(190)
|
11
|
+
|
12
|
+
# Save diagram
|
13
|
+
diagram.save(data_dir + "RotateShape.vdx", Rjb::import('com.aspose.diagram.SaveFileFormat').VDX)
|
14
|
+
|
15
|
+
puts "Rotated shape."
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Asposediagramjava
|
2
|
+
module SelectRerouteOption
|
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
|
+
# Access a particular page
|
10
|
+
page = diagram.getPages().getPage("Flow 1")
|
11
|
+
|
12
|
+
# get a particular connector shape
|
13
|
+
shape = page.getShapes().getShape(1)
|
14
|
+
|
15
|
+
# set reroute option
|
16
|
+
shape.getLayout().getConFixedCode().setValue(Rjb::import('com.aspose.diagram.ConFixedCodeValue').NEVER_REROUTE)
|
17
|
+
|
18
|
+
# Save diagram
|
19
|
+
diagram.save(data_dir + "SelectRerouteOption.vdx", Rjb::import('com.aspose.diagram.SaveFileFormat').VDX)
|
20
|
+
|
21
|
+
puts "Seleted reroute option of the connector shape."
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Asposediagramjava
|
2
|
+
module SetMilestoneShapeProperties
|
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
|
+
shape_id = 1
|
10
|
+
|
11
|
+
# Get timeline shape
|
12
|
+
milestone = diagram.getPages().getPage("Flow 1").getShapes().getShape(shape_id)
|
13
|
+
|
14
|
+
# Initialize MilestoneHelper object
|
15
|
+
milestone_helper = Rjb::import('com.aspose.diagram.MilestoneHelper').new(milestone)
|
16
|
+
|
17
|
+
# Set date format
|
18
|
+
milestone_helper.setDateFormat(21)
|
19
|
+
|
20
|
+
# Set auto update flag
|
21
|
+
milestone_helper.setAutoUpdate(true)
|
22
|
+
|
23
|
+
# Set milestone type
|
24
|
+
milestone_helper.setType(6)
|
25
|
+
|
26
|
+
# Save diagram
|
27
|
+
diagram.save(data_dir + "SetMilestoneShapeProperties.vdx", Rjb::import('com.aspose.diagram.SaveFileFormat').VDX)
|
28
|
+
|
29
|
+
puts "Set milestone shape properties."
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Asposediagramjava
|
2
|
+
module SetShapeAppearance
|
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
|
+
# Access a particular page
|
10
|
+
page = diagram.getPages().getPage("Flow 1")
|
11
|
+
|
12
|
+
# get a particular connector shape
|
13
|
+
shape = page.getShapes().getShape(1)
|
14
|
+
|
15
|
+
# set dynamic connector appearance
|
16
|
+
shape.setConnectorsType(Rjb::import('com.aspose.diagram.ConnectorsTypeValue').STRAIGHT_LINES)
|
17
|
+
|
18
|
+
# Save diagram
|
19
|
+
diagram.save(data_dir + "SetShapeAppearance.vdx", Rjb::import('com.aspose.diagram.SaveFileFormat').VDX)
|
20
|
+
|
21
|
+
puts "Set appearnce of the connector type shape."
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|