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,50 @@
|
|
1
|
+
module Asposediagramjava
|
2
|
+
module ExportToXml
|
3
|
+
def initialize()
|
4
|
+
# Exporting VSD to VDX
|
5
|
+
export_to_vdx()
|
6
|
+
|
7
|
+
# Exporting VSD to VSX
|
8
|
+
export_to_vsx()
|
9
|
+
|
10
|
+
# Exporting VSD to VTX
|
11
|
+
export_to_vtx()
|
12
|
+
end
|
13
|
+
|
14
|
+
def export_to_vdx()
|
15
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
16
|
+
|
17
|
+
# Call the diagram constructor to load diagram from a VSD file
|
18
|
+
diagram = Rjb::import('com.aspose.diagram.Diagram').new(data_dir + "Drawing.vsd")
|
19
|
+
|
20
|
+
# Save as VDX
|
21
|
+
diagram.save(data_dir + "Diagram.vdx", Rjb::import('com.aspose.diagram.SaveFileFormat').VDX)
|
22
|
+
|
23
|
+
puts "Exported visio diagram to VDX."
|
24
|
+
end
|
25
|
+
|
26
|
+
def export_to_vsx()
|
27
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
28
|
+
|
29
|
+
# Call the diagram constructor to load diagram from a VSD file
|
30
|
+
diagram = Rjb::import('com.aspose.diagram.Diagram').new(data_dir + "Drawing.vsd")
|
31
|
+
|
32
|
+
# Save as VSX
|
33
|
+
diagram.save(data_dir + "Diagram.vsx", Rjb::import('com.aspose.diagram.SaveFileFormat').VSX)
|
34
|
+
|
35
|
+
puts "Exported visio diagram to VSX."
|
36
|
+
end
|
37
|
+
|
38
|
+
def export_to_vtx()
|
39
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
40
|
+
|
41
|
+
# Call the diagram constructor to load diagram from a VSD file
|
42
|
+
diagram = Rjb::import('com.aspose.diagram.Diagram').new(data_dir + "Drawing.vsd")
|
43
|
+
|
44
|
+
# Save as VTX
|
45
|
+
diagram.save(data_dir + "Diagram.vtx", Rjb::import('com.aspose.diagram.SaveFileFormat').VTX)
|
46
|
+
|
47
|
+
puts "Exported visio diagram to VTX."
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Asposediagramjava
|
2
|
+
module ExportToXps
|
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
|
+
# Save as XPS
|
10
|
+
diagram.save(data_dir + "Diagram.xps", Rjb::import('com.aspose.diagram.SaveFileFormat').XPS)
|
11
|
+
|
12
|
+
puts "Exported visio diagram to XPS."
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module Asposediagramjava
|
2
|
+
module ShapeGeometrySection
|
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
|
+
#set connector shape id
|
10
|
+
connector_id = 1
|
11
|
+
connector = diagram.getPages().getPage(0).getShapes().getShape(connector_id)
|
12
|
+
|
13
|
+
# get connector geometry at index 0
|
14
|
+
defaultLineTo = connector.getGeoms().get(0).getCoordinateCol().getLineToCol().get(0)
|
15
|
+
|
16
|
+
# remove connector geometry from index 0
|
17
|
+
connector.getGeoms().get(0).getCoordinateCol().getLineToCol().get(0).setDel(1)
|
18
|
+
|
19
|
+
# initialize LineTo geometry object
|
20
|
+
line_to = Rjb::import('com.aspose.diagram.LineTo').new
|
21
|
+
# set X value
|
22
|
+
line_to.getX().setValue(0)
|
23
|
+
# set Y value
|
24
|
+
line_to.getY().setValue(defaultLineTo.getY().getValue() / 2)
|
25
|
+
# add connector geometry
|
26
|
+
connector.getGeoms().get(0).getCoordinateCol().add(line_to)
|
27
|
+
|
28
|
+
# initialize LineTo geometry object
|
29
|
+
line_to = Rjb::import('com.aspose.diagram.LineTo').new
|
30
|
+
# set Y value
|
31
|
+
line_to.getY().setValue(defaultLineTo.getY().getValue() / 2)
|
32
|
+
# set X value
|
33
|
+
line_to.getX().setValue(defaultLineTo.getX().getValue())
|
34
|
+
# add connector geometry
|
35
|
+
connector.getGeoms().get(0).getCoordinateCol().add(line_to)
|
36
|
+
|
37
|
+
# initialize LineTo geometry object
|
38
|
+
line_to = Rjb::import('com.aspose.diagram.LineTo').new
|
39
|
+
# set X value
|
40
|
+
line_to.getX().setValue(defaultLineTo.getX().getValue())
|
41
|
+
# set Y value
|
42
|
+
line_to.getY().setValue(defaultLineTo.getY().getValue())
|
43
|
+
# add connector geometry
|
44
|
+
connector.getGeoms().get(0).getCoordinateCol().add(line_to)
|
45
|
+
|
46
|
+
# Save as Html
|
47
|
+
diagram.save(data_dir + "Geometry.vdx", Rjb::import('com.aspose.diagram.SaveFileFormat').VDX)
|
48
|
+
|
49
|
+
puts "Updated Connector Geometry Section in the ShapeSheet."
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Asposediagramjava
|
2
|
+
module HeadersAndFooters
|
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 page number at the right corner of header
|
10
|
+
diagram.getHeaderFooter().setHeaderRight("&p")
|
11
|
+
|
12
|
+
# set text at the center
|
13
|
+
diagram.getHeaderFooter().setHeaderCenter("Center of the header")
|
14
|
+
|
15
|
+
# set text at the left side
|
16
|
+
diagram.getHeaderFooter().setHeaderLeft("Left of the header")
|
17
|
+
|
18
|
+
# add text at the right corner of footer
|
19
|
+
diagram.getHeaderFooter().setFooterRight("Right of the footer")
|
20
|
+
|
21
|
+
# set text at the center
|
22
|
+
diagram.getHeaderFooter().setFooterCenter("Center of the footer")
|
23
|
+
|
24
|
+
# set text at the left side
|
25
|
+
diagram.getHeaderFooter().setFooterLeft("Left of the footer")
|
26
|
+
|
27
|
+
# set header & footer color
|
28
|
+
diagram.getHeaderFooter().setHeaderFooterColor(Rjb::import('com.aspose.diagram.Color').getRed())
|
29
|
+
|
30
|
+
# set text font properties
|
31
|
+
diagram.getHeaderFooter().getHeaderFooterFont().setItalic(1)
|
32
|
+
diagram.getHeaderFooter().getHeaderFooterFont().setUnderline(0)
|
33
|
+
|
34
|
+
# Save diagram
|
35
|
+
diagram.save(data_dir + "HeadersAndFooters.vdx", Rjb::import('com.aspose.diagram.SaveFileFormat').VDX)
|
36
|
+
|
37
|
+
puts "Done with headers and footers."
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Asposediagramjava
|
2
|
+
module AddHyperlinkToShape
|
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 Hyperlink object
|
10
|
+
hyperlink = Rjb::import('com.aspose.diagram.Hyperlink').new
|
11
|
+
|
12
|
+
# Set address value
|
13
|
+
hyperlink.getAddress().setValue("http://www.google.com/")
|
14
|
+
|
15
|
+
# Set sub address value
|
16
|
+
hyperlink.getSubAddress().setValue("Sub address here")
|
17
|
+
|
18
|
+
# Set description value
|
19
|
+
hyperlink.getDescription().setValue("Description here")
|
20
|
+
|
21
|
+
# Set name
|
22
|
+
hyperlink.setName("MyHyperLink")
|
23
|
+
|
24
|
+
# Add hyperlink to the shape
|
25
|
+
diagram.getPages().getPage("Flow 1").getShapes().getShape(1).getHyperlinks().add(hyperlink)
|
26
|
+
|
27
|
+
# Save diagram
|
28
|
+
diagram.save(data_dir + "Hyperlinks.vdx", Rjb::import('com.aspose.diagram.SaveFileFormat').VDX)
|
29
|
+
|
30
|
+
puts "Added hyperlik to shape successfully!"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Asposediagramjava
|
2
|
+
module GetShapeHyperlinkData
|
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 + "Hyperlinks.vdx")
|
8
|
+
|
9
|
+
# Get a particular shape
|
10
|
+
shape = diagram.getPages().getPage("Flow 1").getShapes().getShape(1)
|
11
|
+
|
12
|
+
hyperlinks = shape.getHyperlinks()
|
13
|
+
|
14
|
+
i = 0
|
15
|
+
while i < hyperlinks.getCount()
|
16
|
+
hyperlink = hyperlinks.get(i)
|
17
|
+
puts "Address: " + hyperlink.getAddress().getValue().to_s
|
18
|
+
puts "Sub Address: " + hyperlink.getSubAddress().getValue().to_s
|
19
|
+
puts "Description: " + hyperlink.getDescription().getValue().to_s
|
20
|
+
|
21
|
+
i +=1
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Asposediagramjava
|
2
|
+
module AddNewLayer
|
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 Visio page
|
10
|
+
page = diagram.getPages().getPage(0)
|
11
|
+
|
12
|
+
# initialize a new Layer class object
|
13
|
+
layer = Rjb::import('com.aspose.diagram.Layer').new
|
14
|
+
|
15
|
+
# set Layer name
|
16
|
+
layer.getName().setValue("Layer2")
|
17
|
+
|
18
|
+
# set Layer Visibility
|
19
|
+
layer.getVisible().setValue(2)
|
20
|
+
|
21
|
+
# add Layer to the particular page sheet
|
22
|
+
page.getPageSheet().getLayers().add(layer)
|
23
|
+
|
24
|
+
# add a new shape
|
25
|
+
shape_id = page.addShape(3.0, 3.0, 0.36, 0.36, "Circle")
|
26
|
+
|
27
|
+
# get the Shape object
|
28
|
+
shape = page.getShapes().getShape(shape_id)
|
29
|
+
|
30
|
+
# assign this new Layer
|
31
|
+
shape.getLayerMem().getLayerMember().setValue(layer.getIX().to_s)
|
32
|
+
|
33
|
+
# Save diagram
|
34
|
+
diagram.save(data_dir + "AddNewLayer.vdx", Rjb::import('com.aspose.diagram.SaveFileFormat').VDX)
|
35
|
+
|
36
|
+
puts "Added a new Layer in the Visio Diagram."
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Asposediagramjava
|
2
|
+
module ConfigureShapeWithLayers
|
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
|
+
#puts shape.getName().to_s
|
15
|
+
if shape.getName() == "Process"
|
16
|
+
# Add shape1 in first two layers. Here "0;1" are indexes of the layers
|
17
|
+
layer = shape.getLayerMem()
|
18
|
+
layer.getLayerMember().setValue("0;1")
|
19
|
+
elsif shape.getName() == "Preparation"
|
20
|
+
# Remove shape2 from all the layers
|
21
|
+
layer = shape.getLayerMem()
|
22
|
+
layer.getLayerMember().setValue("")
|
23
|
+
end
|
24
|
+
|
25
|
+
i +=1
|
26
|
+
end
|
27
|
+
|
28
|
+
# Save diagram
|
29
|
+
diagram.save(data_dir + "Layers.vdx", Rjb::import('com.aspose.diagram.SaveFileFormat').VDX)
|
30
|
+
|
31
|
+
puts "Configured Shape Objects with Layers in Visio."
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Asposediagramjava
|
2
|
+
module GetAllLayers
|
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 Visio page
|
10
|
+
page = diagram.getPages().getPage(0)
|
11
|
+
|
12
|
+
layers = page.getPageSheet().getLayers()
|
13
|
+
|
14
|
+
i = 0
|
15
|
+
while i < layers.getCount()
|
16
|
+
layer = layers.get(i)
|
17
|
+
puts "Name: " + layer.getName().getValue().to_s
|
18
|
+
puts "Visibility: " + layer.getVisible().getValue().to_s
|
19
|
+
puts "Status: " + layer.getStatus().getValue().to_s
|
20
|
+
|
21
|
+
i +=1
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Asposediagramjava
|
2
|
+
module CheckPresenceOfMaster
|
3
|
+
def initialize()
|
4
|
+
# Checking a Master Presence by ID
|
5
|
+
check_presence_master_by_id()
|
6
|
+
|
7
|
+
# Checking a Master Presence by Name
|
8
|
+
check_presence_master_by_name()
|
9
|
+
end
|
10
|
+
|
11
|
+
def check_presence_master_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
|
+
master_id = 2
|
18
|
+
# check master by id
|
19
|
+
is_present = diagram.getMasters().isExist(master_id)
|
20
|
+
|
21
|
+
puts "Master Presence : " + is_present.to_s
|
22
|
+
end
|
23
|
+
|
24
|
+
def check_presence_master_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 master name
|
31
|
+
master_name = "Background tranquil .2"
|
32
|
+
# check master object by name
|
33
|
+
is_present = diagram.getMasters().isExist(master_name)
|
34
|
+
|
35
|
+
puts "Master Presence : " + is_present.to_s
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Asposediagramjava
|
2
|
+
module GetMasterInfo
|
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
|
+
masters = diagram.getMasters()
|
10
|
+
|
11
|
+
i = 0
|
12
|
+
while i < masters.getCount()
|
13
|
+
master = masters.get(i)
|
14
|
+
puts "Master ID : " + master.getID().to_s
|
15
|
+
puts "Master Name : " + master.getName().to_s
|
16
|
+
|
17
|
+
i +=1
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Asposediagramjava
|
2
|
+
module GetMasterObject
|
3
|
+
def initialize()
|
4
|
+
# Getting a Master Object by ID
|
5
|
+
get_master_object_by_id()
|
6
|
+
|
7
|
+
# Getting a Master Object by Name
|
8
|
+
get_master_object_by_name()
|
9
|
+
end
|
10
|
+
|
11
|
+
def get_master_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
|
+
master_id = 2
|
18
|
+
# Get master object by id
|
19
|
+
master = diagram.getMasters().getMaster(master_id)
|
20
|
+
|
21
|
+
puts "Master ID : " + master.getID().to_s
|
22
|
+
puts "Master Name : " + master.getName().to_s
|
23
|
+
end
|
24
|
+
|
25
|
+
def get_master_object_by_name()
|
26
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
27
|
+
|
28
|
+
# Call the diagram constructor to load diagram from a VSD file
|
29
|
+
diagram = Rjb::import('com.aspose.diagram.Diagram').new(data_dir + "Drawing.vsd")
|
30
|
+
|
31
|
+
# Set master name
|
32
|
+
master_name = "Background tranquil .2"
|
33
|
+
# Get master object by name
|
34
|
+
master = diagram.getMasters().getMasterByName(master_name)
|
35
|
+
|
36
|
+
puts "Master ID : " + master.getID().to_s
|
37
|
+
puts "Master Name : " + master.getName().to_s
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module Asposediagramjava
|
2
|
+
module AddPage
|
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
|
+
# Get max page ID
|
10
|
+
max_page_id = get_max_page_id(diagram)
|
11
|
+
|
12
|
+
# Initialize a new page object
|
13
|
+
new_page = Rjb::import('com.aspose.diagram.Page').new
|
14
|
+
|
15
|
+
# Set name
|
16
|
+
new_page.setName("new page")
|
17
|
+
|
18
|
+
# Set page ID
|
19
|
+
new_page.setID(max_page_id + 1)
|
20
|
+
|
21
|
+
# Or try the Page constructor
|
22
|
+
# Page newPage = new Page(MaxPageId + 1);
|
23
|
+
|
24
|
+
# Add a new blank page
|
25
|
+
diagram.getPages().add(new_page)
|
26
|
+
|
27
|
+
# Save diagram
|
28
|
+
diagram.save(data_dir + "NewPage_Output.vdx", Rjb::import('com.aspose.diagram.SaveFileFormat').VDX)
|
29
|
+
|
30
|
+
puts "Added new page."
|
31
|
+
end
|
32
|
+
|
33
|
+
def get_max_page_id(diagram)
|
34
|
+
max = diagram.getPages().getPage(0).getID()
|
35
|
+
i = 1
|
36
|
+
while i < diagram.getPages().getCount()
|
37
|
+
if max < diagram.getPages().getPage(i).getID()
|
38
|
+
max = diagram.getPages().getPage(i).getID()
|
39
|
+
end
|
40
|
+
i +=1
|
41
|
+
end
|
42
|
+
return max
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|