asposeslidesjava 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +3 -0
  3. data/LICENSE +21 -0
  4. data/README.md +31 -0
  5. data/Rakefile +2 -0
  6. data/asposeslidesjava.gemspec +27 -0
  7. data/config/aspose.yml +5 -0
  8. data/data/Aspose.html +55 -0
  9. data/data/Aspose.pptx +0 -0
  10. data/data/AsposeChart.pptx +0 -0
  11. data/data/Bass-Drum.wav +0 -0
  12. data/data/HelloWorld.pptx +0 -0
  13. data/data/Presentation1.ppt +0 -0
  14. data/data/Shapes/OleEmbed.pptx +0 -0
  15. data/data/Shapes/Wildlife.mp4 +0 -0
  16. data/data/Shapes/sample.xlsx +0 -0
  17. data/data/Source.odp +0 -0
  18. data/data/Tables/aspose-logo.jpg +0 -0
  19. data/data/Tables/demotable.pptx +0 -0
  20. data/data/Text/Welcome.pptx +0 -0
  21. data/data/Text/import.html +119 -0
  22. data/data/Text/input.pptx +0 -0
  23. data/data/Wildlife.mp4 +0 -0
  24. data/data/WithActiveX.pptm +0 -0
  25. data/data/aspose-logo.jpg +0 -0
  26. data/data/demo.pptx +0 -0
  27. data/data/night.jpg +0 -0
  28. data/data/vbamacro.pptx +0 -0
  29. data/lib/asposeslidesjava.rb +71 -0
  30. data/lib/asposeslidesjava/ActiveX/addactivex.rb +21 -0
  31. data/lib/asposeslidesjava/Charts/chartlegend.rb +33 -0
  32. data/lib/asposeslidesjava/Charts/chartproperties.rb +120 -0
  33. data/lib/asposeslidesjava/Charts/chartseries.rb +28 -0
  34. data/lib/asposeslidesjava/Charts/charttrendlines.rb +53 -0
  35. data/lib/asposeslidesjava/Charts/createchart.rb +163 -0
  36. data/lib/asposeslidesjava/Charts/errorbars.rb +84 -0
  37. data/lib/asposeslidesjava/Charts/existingchart.rb +66 -0
  38. data/lib/asposeslidesjava/Charts/formattingchartentities.rb +163 -0
  39. data/lib/asposeslidesjava/Charts/setlabeldistance.rb +24 -0
  40. data/lib/asposeslidesjava/Charts/setpiechartcolors.rb +118 -0
  41. data/lib/asposeslidesjava/Presentation/convertingtohtml.rb +25 -0
  42. data/lib/asposeslidesjava/Presentation/convertingtonotes.rb +37 -0
  43. data/lib/asposeslidesjava/Presentation/convertingtopdf.rb +16 -0
  44. data/lib/asposeslidesjava/Presentation/convertingtotiff.rb +62 -0
  45. data/lib/asposeslidesjava/Presentation/convertingtoxps.rb +43 -0
  46. data/lib/asposeslidesjava/Presentation/odptopptx.rb +16 -0
  47. data/lib/asposeslidesjava/Presentation/ppttopptx.rb +16 -0
  48. data/lib/asposeslidesjava/Presentation/properties.rb +106 -0
  49. data/lib/asposeslidesjava/Presentation/zoom.rb +20 -0
  50. data/lib/asposeslidesjava/Shapes/addellipseshape.rb +60 -0
  51. data/lib/asposeslidesjava/Shapes/addinglineshape.rb +65 -0
  52. data/lib/asposeslidesjava/Shapes/addrectangleshape.rb +58 -0
  53. data/lib/asposeslidesjava/Shapes/cloneshape.rb +32 -0
  54. data/lib/asposeslidesjava/Shapes/connectshapes.rb +83 -0
  55. data/lib/asposeslidesjava/Shapes/embedvideo.rb +32 -0
  56. data/lib/asposeslidesjava/Shapes/fillingshapes.rb +98 -0
  57. data/lib/asposeslidesjava/Shapes/findshape.rb +30 -0
  58. data/lib/asposeslidesjava/Shapes/formatlines.rb +99 -0
  59. data/lib/asposeslidesjava/Shapes/frame.rb +85 -0
  60. data/lib/asposeslidesjava/Shapes/groupshape.rb +35 -0
  61. data/lib/asposeslidesjava/Shapes/oleobject.rb +26 -0
  62. data/lib/asposeslidesjava/Shapes/rotatingshapes.rb +25 -0
  63. data/lib/asposeslidesjava/Shapes/shapeproperties.rb +30 -0
  64. data/lib/asposeslidesjava/Shapes/shapethumbnail.rb +18 -0
  65. data/lib/asposeslidesjava/Slides/accessslides.rb +38 -0
  66. data/lib/asposeslidesjava/Slides/addslides.rb +28 -0
  67. data/lib/asposeslidesjava/Slides/background.rb +76 -0
  68. data/lib/asposeslidesjava/Slides/changingposition.rb +22 -0
  69. data/lib/asposeslidesjava/Slides/cloneslides.rb +72 -0
  70. data/lib/asposeslidesjava/Slides/creatingsvg.rb +27 -0
  71. data/lib/asposeslidesjava/Slides/hyperlinks.rb +19 -0
  72. data/lib/asposeslidesjava/Slides/removeslides.rb +46 -0
  73. data/lib/asposeslidesjava/Slides/sizeandlayout.rb +55 -0
  74. data/lib/asposeslidesjava/Slides/thumbnail.rb +113 -0
  75. data/lib/asposeslidesjava/Slides/transitions.rb +24 -0
  76. data/lib/asposeslidesjava/SmartArt/addsmartart.rb +26 -0
  77. data/lib/asposeslidesjava/SmartArt/fillformat.rb +28 -0
  78. data/lib/asposeslidesjava/Tables/addimage.rb +34 -0
  79. data/lib/asposeslidesjava/Tables/aligntext.rb +48 -0
  80. data/lib/asposeslidesjava/Tables/clonerowcolumn.rb +76 -0
  81. data/lib/asposeslidesjava/Tables/createtable.rb +61 -0
  82. data/lib/asposeslidesjava/Tables/removerowcolumn.rb +27 -0
  83. data/lib/asposeslidesjava/Text/createtextbox.rb +79 -0
  84. data/lib/asposeslidesjava/Text/exporttexttohtml.rb +30 -0
  85. data/lib/asposeslidesjava/Text/importhtml.rb +51 -0
  86. data/lib/asposeslidesjava/Text/managefont.rb +30 -0
  87. data/lib/asposeslidesjava/Text/managetext.rb +128 -0
  88. data/lib/asposeslidesjava/Text/paragraphs.rb +260 -0
  89. data/lib/asposeslidesjava/Text/replacetext.rb +23 -0
  90. data/lib/asposeslidesjava/Text/shadoweffects.rb +37 -0
  91. data/lib/asposeslidesjava/Text/textfont.rb +130 -0
  92. data/lib/asposeslidesjava/Text/wordart.rb +45 -0
  93. data/lib/asposeslidesjava/VBAMacros/removevbamacro.rb +18 -0
  94. data/lib/asposeslidesjava/activex.rb +1 -0
  95. data/lib/asposeslidesjava/asposeslides.rb +10 -0
  96. data/lib/asposeslidesjava/charts.rb +9 -0
  97. data/lib/asposeslidesjava/helloworld.rb +38 -0
  98. data/lib/asposeslidesjava/presentation.rb +9 -0
  99. data/lib/asposeslidesjava/shapes.rb +15 -0
  100. data/lib/asposeslidesjava/slides.rb +11 -0
  101. data/lib/asposeslidesjava/smartart.rb +2 -0
  102. data/lib/asposeslidesjava/tables.rb +5 -0
  103. data/lib/asposeslidesjava/text.rb +10 -0
  104. data/lib/asposeslidesjava/vbamacros.rb +1 -0
  105. data/lib/asposeslidesjava/version.rb +3 -0
  106. data/samples/test.rb +8 -0
  107. metadata +206 -0
@@ -0,0 +1,32 @@
1
+ module Asposeslidesjava
2
+ module CloneShape
3
+ def initialize()
4
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/Shapes/'
5
+
6
+ # Create an instance of Presentation class
7
+ srcPres = Rjb::import('com.aspose.slides.Presentation').new(data_dir + 'demo.pptx')
8
+
9
+ # Accessing source slide shape collection
10
+ sourceShapes = srcPres.getSlides().get_Item(0).getShapes()
11
+
12
+ blankLayout = srcPres.getMasters().get_Item(0).getLayoutSlides().getByType(Rjb::import('com.aspose.slides.SlideLayoutType').Blank)
13
+
14
+ destSlide = srcPres.getSlides().addEmptySlide(blankLayout)
15
+
16
+ # Accessing destination slide shape collection
17
+ destShapes = destSlide.getShapes()
18
+
19
+ # Clone shapes by using different methods
20
+ destShapes.addClone(sourceShapes.get_Item(1), 50, 150 + sourceShapes.get_Item(0).getHeight())
21
+ destShapes.addClone(sourceShapes.get_Item(2))
22
+ destShapes.addClone(sourceShapes.get_Item(3), 50, 200, 50, 50)
23
+ destShapes.insertClone(0, sourceShapes.get_Item(0), 50, 150)
24
+
25
+ # Write the presentation as a PPTX file
26
+ save_format = Rjb::import('com.aspose.slides.SaveFormat')
27
+ srcPres.save(data_dir + "CloneShape.pptx", save_format.Pptx)
28
+
29
+ puts "Cloned shape, please check the output file."
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,83 @@
1
+ module Asposeslidesjava
2
+ module ConnectShapes
3
+ def initialize()
4
+ # Connecting shapes using connectors
5
+ connect_shapes()
6
+
7
+ # Connecting Shape with connector on desired connection site
8
+ connect_shapes_with_connector()
9
+ end
10
+
11
+ def connect_shapes()
12
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/Shapes/'
13
+
14
+ # Create an instance of Presentation class
15
+ pres = Rjb::import('com.aspose.slides.Presentation').new
16
+
17
+ # Accessing shapes collection for selected slide
18
+ shapes = pres.getSlides().get_Item(0).getShapes()
19
+
20
+ shape_type = Rjb::import('com.aspose.slides.ShapeType')
21
+
22
+ # Add autoshape Ellipse
23
+ ellipse = shapes.addAutoShape(shape_type.Ellipse, 0, 100, 100, 100)
24
+
25
+ # Add autoshape Rectangle
26
+ rectangle = shapes.addAutoShape(shape_type.Rectangle, 100, 300, 100, 100)
27
+
28
+ # Adding connector shape to slide shape collection
29
+ connector = shapes.addConnector(shape_type.BentConnector2, 0, 0, 10, 10)
30
+
31
+ # Joining Shapes to connectors
32
+ connector.setStartShapeConnectedTo(ellipse)
33
+ connector.setEndShapeConnectedTo(rectangle)
34
+ connector.reroute()
35
+
36
+ # Write the presentation as a PPTX file
37
+ save_format = Rjb::import('com.aspose.slides.SaveFormat')
38
+ pres.save(data_dir + "ConnectShapes.pptx", save_format.Pptx)
39
+
40
+ puts "Connected shapes, please check the output file."
41
+ end
42
+
43
+ def connect_shapes_with_connector()
44
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/Shapes/'
45
+
46
+ # Create an instance of Presentation class
47
+ pres = Rjb::import('com.aspose.slides.Presentation').new
48
+
49
+ # Accessing shapes collection for selected slide
50
+ shapes = pres.getSlides().get_Item(0).getShapes()
51
+
52
+ shape_type = Rjb::import('com.aspose.slides.ShapeType')
53
+
54
+ # Add autoshape Ellipse
55
+ ellipse = shapes.addAutoShape(shape_type.Ellipse, 0, 100, 100, 100)
56
+
57
+ # Add autoshape Rectangle
58
+ rectangle = shapes.addAutoShape(shape_type.Rectangle, 100, 300, 100, 100)
59
+
60
+ # Adding connector shape to slide shape collection
61
+ connector = shapes.addConnector(shape_type.BentConnector2, 0, 0, 10, 10)
62
+
63
+ # Joining Shapes to connectors
64
+ connector.setStartShapeConnectedTo(ellipse)
65
+ connector.setEndShapeConnectedTo(rectangle)
66
+
67
+ # Setting the desired connection site index of Ellipse shape for connector to get connected
68
+ wantedIndex = 6
69
+
70
+ # Checking if desired index is less than maximum site index count
71
+ if ellipse.getConnectionSiteCount() > wantedIndex
72
+ # Setting the desired connection site for connector on Ellipse
73
+ connector.setStartShapeConnectionSiteIndex(wantedIndex)
74
+ end
75
+
76
+ # Write the presentation as a PPTX file
77
+ save_format = Rjb::import('com.aspose.slides.SaveFormat')
78
+ pres.save(data_dir + "ConnectShapesWithConnector.pptx", save_format.Pptx)
79
+
80
+ puts "Connected shapes with connector, please check the output file."
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,32 @@
1
+ module Asposeslidesjava
2
+ module EmbedVideo
3
+ def initialize()
4
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/Shapes/'
5
+
6
+ # Create an instance of Presentation class
7
+ pres = Rjb::import('com.aspose.slides.Presentation').new
8
+
9
+ # Get the first slide
10
+ sld = pres.getSlides().get_Item(0)
11
+
12
+ # Embedd vide inside presentation
13
+ vid = pres.getVideos().addVideo(Rjb::import('java.io.FileInputStream').new(Rjb::import('java.io.File').new(data_dir + "Wildlife.mp4")))
14
+
15
+ # Add Video Frame
16
+ vf = sld.getShapes().addVideoFrame(50, 150, 300, 350, vid)
17
+
18
+ # Set video to Video Frame
19
+ vf.setEmbeddedVideo(vid)
20
+
21
+ # Set Play Mode and Volume of the Video
22
+ vf.setPlayMode(Rjb::import('com.aspose.slides.VideoPlayModePreset').Auto)
23
+ vf.setVolume(Rjb::import('com.aspose.slides.AudioVolumeMode').Loud)
24
+
25
+ # Write the presentation as a PPTX file
26
+ save_format = Rjb::import('com.aspose.slides.SaveFormat')
27
+ pres.save(data_dir + "VideoFrame.pptx", save_format.Pptx)
28
+
29
+ puts "Embedded video frame in a slide, please check the output file."
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,98 @@
1
+ module Asposeslidesjava
2
+ module FillingShapes
3
+ def initialize()
4
+ # Filling Shapes with Pattern
5
+ fill_shapes_with_pattern()
6
+
7
+ # Filling Shapes with Picture
8
+ fill_shapes_with_picture()
9
+
10
+ # Filling Shapes with Solid Color
11
+ fill_shapes_with_solid_color()
12
+ end
13
+
14
+ def fill_shapes_with_pattern()
15
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/Shapes/'
16
+
17
+ # Create an instance of Presentation class
18
+ pres = Rjb::import('com.aspose.slides.Presentation').new
19
+
20
+ # Get the first slide
21
+ sld = pres.getSlides().get_Item(0)
22
+
23
+ # Add autoshape of rectangle type
24
+ shp = sld.getShapes().addAutoShape(Rjb::import('com.aspose.slides.ShapeType').Rectangle, 50, 150, 75, 150)
25
+
26
+ # Set the fill type to Pattern
27
+ shp.getFillFormat().setFillType(Rjb::import('com.aspose.slides.FillType').Pattern)
28
+
29
+ # Set the pattern style
30
+ shp.getFillFormat().getPatternFormat().setPatternStyle(Rjb::import('com.aspose.slides.PatternStyle').Trellis)
31
+
32
+ # Set the pattern back and fore colors
33
+ shp.getFillFormat().getPatternFormat().getBackColor().setColor(Rjb::import('java.awt.Color').LIGHT_GRAY)
34
+ shp.getFillFormat().getPatternFormat().getForeColor().setColor(Rjb::import('java.awt.Color').YELLOW)
35
+
36
+ # Write the presentation as a PPTX file
37
+ save_format = Rjb::import('com.aspose.slides.SaveFormat')
38
+ pres.save(data_dir + "RectShpPatt.pptx", save_format.Pptx)
39
+
40
+ puts "Filled shapes with Pattern, please check the output file."
41
+ end
42
+
43
+ def fill_shapes_with_picture()
44
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/Shapes/'
45
+
46
+ # Create an instance of Presentation class
47
+ pres = Rjb::import('com.aspose.slides.Presentation').new
48
+
49
+ # Get the first slide
50
+ sld = pres.getSlides().get_Item(0)
51
+
52
+ # Add autoshape of rectangle type
53
+ shp = sld.getShapes().addAutoShape(Rjb::import('com.aspose.slides.ShapeType').Rectangle, 50, 150, 75, 150)
54
+
55
+ # Set the fill type to Picture
56
+ shp.getFillFormat().setFillType(Rjb::import('com.aspose.slides.FillType').Picture)
57
+
58
+ # Set the picture fill mode
59
+ shp.getFillFormat().getPictureFillFormat().setPictureFillMode(Rjb::import('com.aspose.slides.PictureFillMode').Tile)
60
+
61
+ # Set the picture
62
+ imgx = pres.getImages().addImage(Rjb::import('java.io.FileInputStream').new(Rjb::import('java.io.File').new(data_dir + "night.jpg")))
63
+
64
+ shp.getFillFormat().getPictureFillFormat().getPicture().setImage(imgx)
65
+
66
+ # Write the presentation as a PPTX file
67
+ save_format = Rjb::import('com.aspose.slides.SaveFormat')
68
+ pres.save(data_dir + "RectShpPic.pptx", save_format.Pptx)
69
+
70
+ puts "Filled shapes with Picture, please check the output file."
71
+ end
72
+
73
+ def fill_shapes_with_solid_color()
74
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/Shapes/'
75
+
76
+ # Create an instance of Presentation class
77
+ pres = Rjb::import('com.aspose.slides.Presentation').new
78
+
79
+ # Get the first slide
80
+ sld = pres.getSlides().get_Item(0)
81
+
82
+ # Add autoshape of rectangle type
83
+ shp = sld.getShapes().addAutoShape(Rjb::import('com.aspose.slides.ShapeType').Rectangle, 50, 150, 75, 150)
84
+
85
+ # Set the fill type to Solid
86
+ shp.getFillFormat().setFillType(Rjb::import('com.aspose.slides.FillType').Solid)
87
+
88
+ # Set the color of the rectangle
89
+ shp.getFillFormat().getSolidFillColor().setColor(Rjb::import('java.awt.Color').YELLOW)
90
+
91
+ # Write the presentation as a PPTX file
92
+ save_format = Rjb::import('com.aspose.slides.SaveFormat')
93
+ pres.save(data_dir + "RectShpSolid.pptx", save_format.Pptx)
94
+
95
+ puts "Filled shapes with Solid Color, please check the output file."
96
+ end
97
+ end
98
+ end
@@ -0,0 +1,30 @@
1
+ module Asposeslidesjava
2
+ module FindShape
3
+ def initialize()
4
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/Shapes/'
5
+
6
+ # Create an instance of Presentation class
7
+ pres = Rjb::import('com.aspose.slides.Presentation').new(data_dir + 'demo.pptx')
8
+
9
+ # Get the first slide
10
+ slide = pres.getSlides().get_Item(0)
11
+
12
+ shape = find_shape(slide, "Shape1")
13
+
14
+ puts "Shape: " + shape.to_string
15
+ end
16
+
17
+ def find_shape(slide, alttext)
18
+ #Iterating through all shapes inside the slide
19
+ i = 0
20
+ while i < slide.getShapes().size()
21
+ # If the alternative text of the slide matches with the required one then return the shape
22
+ if slide.getShapes().get_Item(i).getAlternativeText() == alttext
23
+ return slide.getShapes().get_Item(i)
24
+ end
25
+ i +=1
26
+ end
27
+ return nil
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,99 @@
1
+ module Asposeslidesjava
2
+ module FormatLines
3
+ def initialize()
4
+ # Formatting the Lines of Shapes
5
+ format_lines()
6
+
7
+ # Formatting the Join Styles
8
+ format_join_styles()
9
+ end
10
+
11
+ def format_lines()
12
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/Shapes/'
13
+
14
+ # Create an instance of Presentation class
15
+ pres = Rjb::import('com.aspose.slides.Presentation').new
16
+
17
+ # Get the first slide
18
+ sld = pres.getSlides().get_Item(0)
19
+
20
+ # Add autoshape of rectangle type
21
+ shp = sld.getShapes().addAutoShape(Rjb::import('com.aspose.slides.ShapeType').Rectangle, 50, 150, 75, 150)
22
+
23
+ # Set the fill color of the rectangle shape
24
+ shp.getFillFormat().setFillType(Rjb::import('com.aspose.slides.FillType').Solid)
25
+ shp.getFillFormat().getSolidFillColor().setColor(Rjb::import('java.awt.Color').WHITE)
26
+
27
+ # Apply some formatting on the line of the rectangle
28
+ shp.getLineFormat().setStyle(Rjb::import('com.aspose.slides.LineStyle').ThickThin)
29
+ shp.getLineFormat().setWidth(7)
30
+ shp.getLineFormat().setDashStyle(Rjb::import('com.aspose.slides.LineDashStyle').Dash)
31
+
32
+ # set the color of the line of rectangle
33
+ shp.getLineFormat().getFillFormat().setFillType(Rjb::import('com.aspose.slides.FillType').Solid)
34
+ shp.getLineFormat().getFillFormat().getSolidFillColor().setColor(Rjb::import('java.awt.Color').BLUE)
35
+
36
+ # Write the presentation as a PPTX file
37
+ save_format = Rjb::import('com.aspose.slides.SaveFormat')
38
+ pres.save(data_dir + "RectShpLn.pptx", save_format.Pptx)
39
+
40
+ puts "Formatted lines, please check the output file."
41
+ end
42
+
43
+ def format_join_styles()
44
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/Shapes/'
45
+
46
+ # Create an instance of Presentation class
47
+ pres = Rjb::import('com.aspose.slides.Presentation').new
48
+
49
+ # Get the first slide
50
+ sld = pres.getSlides().get_Item(0)
51
+
52
+ # Add three autoshapes of rectangle type
53
+ shape_type = Rjb::import('com.aspose.slides.ShapeType')
54
+ shp1 = sld.getShapes().addAutoShape(shape_type.Rectangle, 50, 100, 150, 75)
55
+ shp2 = sld.getShapes().addAutoShape(shape_type.Rectangle, 300, 100, 150, 75)
56
+ shp3 = sld.getShapes().addAutoShape(shape_type.Rectangle, 50, 250, 150, 75)
57
+
58
+ # Set the fill color of the rectangle shape
59
+ fill_type = Rjb::import('com.aspose.slides.FillType')
60
+ color = Rjb::import('java.awt.Color')
61
+ shp1.getFillFormat().setFillType(fill_type.Solid)
62
+ shp1.getFillFormat().getSolidFillColor().setColor(color.BLACK)
63
+ shp2.getFillFormat().setFillType(fill_type.Solid)
64
+ shp2.getFillFormat().getSolidFillColor().setColor(color.BLACK)
65
+ shp3.getFillFormat().setFillType(fill_type.Solid)
66
+ shp3.getFillFormat().getSolidFillColor().setColor(color.BLACK)
67
+
68
+ # Set the line width
69
+ shp1.getLineFormat().setWidth(15)
70
+ shp2.getLineFormat().setWidth(15)
71
+ shp3.getLineFormat().setWidth (15)
72
+
73
+ # Set the color of the line of rectangle
74
+ shp1.getLineFormat().getFillFormat().setFillType(fill_type.Solid)
75
+ shp1.getLineFormat().getFillFormat().getSolidFillColor().setColor(color.BLUE)
76
+ shp2.getLineFormat().getFillFormat().setFillType(fill_type.Solid)
77
+ shp2.getLineFormat().getFillFormat().getSolidFillColor().setColor(color.BLUE)
78
+ shp3.getLineFormat().getFillFormat().setFillType(fill_type.Solid)
79
+ shp3.getLineFormat().getFillFormat().getSolidFillColor().setColor(color.BLUE)
80
+
81
+ # Set the Join Style
82
+ line_join_style = Rjb::import('com.aspose.slides.LineJoinStyle')
83
+ shp1.getLineFormat().setJoinStyle(line_join_style.Miter)
84
+ shp2.getLineFormat().setJoinStyle(line_join_style.Bevel)
85
+ shp3.getLineFormat().setJoinStyle(line_join_style.Round)
86
+
87
+ # Add text to each rectangle
88
+ shp1.getTextFrame().setText ("This is Miter Join Style")
89
+ shp2.getTextFrame().setText( "This is Bevel Join Style")
90
+ shp3.getTextFrame().setText ("This is Round Join Style")
91
+
92
+ # Write the presentation as a PPTX file
93
+ save_format = Rjb::import('com.aspose.slides.SaveFormat')
94
+ pres.save(data_dir + "RectShpLnJoin.pptx", save_format.Pptx)
95
+
96
+ puts "Formatted join styles, please check the output file."
97
+ end
98
+ end
99
+ end
@@ -0,0 +1,85 @@
1
+ module Asposeslidesjava
2
+ module Frame
3
+ def initialize()
4
+ # Adding Picture Frame to Slide
5
+ add_picture_frame()
6
+
7
+ # Adding Audio Frame to Slide
8
+ add_audio_frame()
9
+
10
+ # Adding Audio Frame to Slide
11
+ add_video_frame()
12
+ end
13
+
14
+ def add_picture_frame()
15
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/Shapes/'
16
+
17
+ # Create an instance of Presentation class
18
+ pres = Rjb::import('com.aspose.slides.Presentation').new
19
+
20
+ # Get the first slide
21
+ sld = pres.getSlides().get_Item(0)
22
+
23
+ # Instantiate the Image class
24
+ imgx = pres.getImages().addImage(Rjb::import('java.io.FileInputStream').new(Rjb::import('java.io.File').new(data_dir + "aspose-logo.jpg")))
25
+
26
+ # Add Picture Frame with height and width equivalent of Picture
27
+ sld.getShapes().addPictureFrame(Rjb::import('com.aspose.slides.ShapeType').Rectangle, 50, 150, imgx.getWidth(), imgx.getHeight(), imgx)
28
+
29
+ # Write the presentation as a PPTX file
30
+ save_format = Rjb::import('com.aspose.slides.SaveFormat')
31
+ pres.save(data_dir + "RectPicFrame.pptx", save_format.Pptx)
32
+
33
+ puts "Added picture frame to slide, please check the output file."
34
+ end
35
+
36
+ def add_audio_frame()
37
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/Shapes/'
38
+
39
+ # Create an instance of Presentation class
40
+ pres = Rjb::import('com.aspose.slides.Presentation').new
41
+
42
+ # Get the first slide
43
+ sld = pres.getSlides().get_Item(0)
44
+
45
+ # Load the wav sound file to stram
46
+ fstr = Rjb::import('java.io.FileInputStream').new(Rjb::import('java.io.File').new(data_dir + "Bass-Drum.wav"))
47
+
48
+ # Add Audio Frame
49
+ af = sld.getShapes().addAudioFrameEmbedded(50, 150, 100, 100, fstr)
50
+
51
+ # Set Play Mode and Volume of the Audio
52
+ af.setPlayMode(Rjb::import('com.aspose.slides.AudioPlayModePreset').Auto)
53
+ af.setVolume(Rjb::import('com.aspose.slides.AudioVolumeMode').Loud)
54
+
55
+ # Write the presentation as a PPTX file
56
+ save_format = Rjb::import('com.aspose.slides.SaveFormat')
57
+ pres.save(data_dir + "AudioFrameEmbed.pptx", save_format.Pptx)
58
+
59
+ puts "Added audio frame to slide, please check the output file."
60
+ end
61
+
62
+ def add_video_frame()
63
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/Shapes/'
64
+
65
+ # Create an instance of Presentation class
66
+ pres = Rjb::import('com.aspose.slides.Presentation').new
67
+
68
+ # Get the first slide
69
+ sld = pres.getSlides().get_Item(0)
70
+
71
+ # Add Video Frame
72
+ vf = sld.getShapes().addVideoFrame(50, 150, 300, 150, data_dir + "Wildlife.mp4")
73
+
74
+ # Set Play Mode and Volume of the Video
75
+ vf.setPlayMode(Rjb::import('com.aspose.slides.VideoPlayModePreset').Auto)
76
+ vf.setVolume(Rjb::import('com.aspose.slides.AudioVolumeMode').Loud)
77
+
78
+ # Write the presentation as a PPTX file
79
+ save_format = Rjb::import('com.aspose.slides.SaveFormat')
80
+ pres.save(data_dir + "VideoFrame.pptx", save_format.Pptx)
81
+
82
+ puts "Added video frame to slide, please check the output file."
83
+ end
84
+ end
85
+ end