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,62 @@
1
+ module Asposeslidesjava
2
+ module ConvertingToTiff
3
+ def initialize()
4
+ # Converting Presentation to TIFF with default size
5
+ convert_with_default_size()
6
+
7
+ # Converting Presentation to TIFF with custom size
8
+ convert_with_custom_size()
9
+ end
10
+
11
+ def convert_with_default_size()
12
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
13
+
14
+ # Instantiate a Presentation object that represents a PPTX file
15
+ pres = Rjb::import('com.aspose.slides.Presentation').new(data_dir + "Aspose.pptx")
16
+
17
+ # Saving the PPTX presentation to Tiff format
18
+ save_format = Rjb::import('com.aspose.slides.SaveFormat')
19
+ pres.save(data_dir + "Aspose.tiff", save_format.Tiff)
20
+
21
+ puts "Document has been converted, please check the output file."
22
+ end
23
+
24
+ def convert_with_custom_size()
25
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
26
+
27
+ # Instantiate a Presentation object that represents a PPTX file
28
+ pres = Rjb::import('com.aspose.slides.Presentation').new(data_dir + "Aspose.pptx")
29
+
30
+ # Instantiate the TiffOptions class
31
+ opts = Rjb::import('com.aspose.slides.TiffOptions').new
32
+
33
+ # Setting compression type
34
+ tiff_compression_types = Rjb::import('com.aspose.slides.TiffCompressionTypes')
35
+ opts.setCompressionType (tiff_compression_types.Default)
36
+
37
+ # Compression Types
38
+ #Default - Specifies the default compression scheme (LZW).
39
+ #None - Specifies no compression.
40
+ #CCITT3
41
+ #CCITT4
42
+ #LZW
43
+ #RLE
44
+
45
+ # Depth – depends on the compression type and cannot be set manually.
46
+ # Resolution unit – is always equal to “2” (dots per inch)
47
+
48
+ #Setting image DPI
49
+ opts.setDpiX(200)
50
+ opts.setDpiY(100)
51
+
52
+ # Set Image Size
53
+ opts.setImageSize(Rjb::import('java.awt.Dimension').new(1728, 1078))
54
+
55
+ # Save the presentation to TIFF with specified image size
56
+ save_format = Rjb::import('com.aspose.slides.SaveFormat')
57
+ pres.save(data_dir + "Aspose-Custom-Size.tiff", save_format.Tiff, opts)
58
+
59
+ puts "Document has been converted, please check the output file."
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,43 @@
1
+ module Asposeslidesjava
2
+ module ConvertingToXps
3
+ def initialize()
4
+ # Converting Presentation to TIFF with default size
5
+ convert_with_default_size()
6
+
7
+ # Converting Presentation to TIFF with custom size
8
+ convert_with_custom_size()
9
+ end
10
+
11
+ def convert_with_default_size()
12
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
13
+
14
+ # Instantiate a Presentation object that represents a PPTX file
15
+ pres = Rjb::import('com.aspose.slides.Presentation').new(data_dir + "Aspose.pptx")
16
+
17
+ # Saving the presentation to XPS format
18
+ save_format = Rjb::import('com.aspose.slides.SaveFormat')
19
+ pres.save(data_dir + "Aspose.xps", save_format.Xps)
20
+
21
+ puts "Document has been converted, please check the output file."
22
+ end
23
+
24
+ def convert_with_custom_size()
25
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
26
+
27
+ # Instantiate a Presentation object that represents a PPTX file
28
+ pres = Rjb::import('com.aspose.slides.Presentation').new(data_dir + "Aspose.pptx")
29
+
30
+ # Instantiate the TiffOptions class
31
+ opts = Rjb::import('com.aspose.slides.XpsOptions').new
32
+
33
+ # Save MetaFiles as PNG
34
+ opts.SaveMetafilesAsPng = true
35
+
36
+ # Save the presentation to TIFF with specified image size
37
+ save_format = Rjb::import('com.aspose.slides.SaveFormat')
38
+ pres.save(data_dir + "Aspose-Custom-Size.xps", save_format.Xps, opts)
39
+
40
+ puts "Document has been converted, please check the output file."
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,16 @@
1
+ module Asposeslidesjava
2
+ module OdpToPptx
3
+ def initialize()
4
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
5
+
6
+ # Instantiate a Presentation object that represents a PPTX file
7
+ pres = Rjb::import('com.aspose.slides.Presentation').new(data_dir + "Source.odp")
8
+
9
+ # Saving the PPTX presentation to PPTX format
10
+ save_format = Rjb::import('com.aspose.slides.SaveFormat')
11
+ pres.save(data_dir + "Source.pptx", save_format.Pptx)
12
+
13
+ puts "Document has been converted, please check the output file."
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ module Asposeslidesjava
2
+ module PptToPptx
3
+ def initialize()
4
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
5
+
6
+ # Instantiate a Presentation object that represents a PPTX file
7
+ pres = Rjb::import('com.aspose.slides.Presentation').new(data_dir + "Presentation1.ppt")
8
+
9
+ # Saving the PPTX presentation to PPTX format
10
+ save_format = Rjb::import('com.aspose.slides.SaveFormat')
11
+ pres.save(data_dir + "Aspose.pptx", save_format.Pptx)
12
+
13
+ puts "Document has been converted, please check the output file."
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,106 @@
1
+ module Asposeslidesjava
2
+ module Properties
3
+ def initialize()
4
+ # Accessing Built-in Properties
5
+ get_properties()
6
+
7
+ # Modifying Built-in Properties
8
+ update_properties()
9
+
10
+ # Adding Custom Document Properties
11
+ add_custom_properties()
12
+ end
13
+
14
+ def get_properties()
15
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
16
+
17
+ # Instantiate the Presentation class that represents the presentation
18
+ pres = Rjb::import('com.aspose.slides.Presentation').new(data_dir + "HelloWorld.pptx")
19
+
20
+ # Create a reference to IDocumentProperties object associated with Presentation
21
+ dp = pres.getDocumentProperties()
22
+
23
+ # Display the builtin properties
24
+ puts "Category : " + dp.getCategory().to_s
25
+ puts "Current Status : " + dp.getContentStatus().to_s
26
+ puts "Creation Date : " + dp.getCreatedTime().to_string
27
+ puts "Author : " + dp.getAuthor().to_s
28
+ puts "Description : " + dp.getComments().to_s
29
+ puts "KeyWords : " + dp.getKeywords().to_s
30
+ puts "Last Modified By : " + dp.getLastSavedBy().to_s
31
+ puts "Supervisor : " + dp.getManager().to_s
32
+ puts "Modified Date : " + dp.getLastSavedTime().to_string
33
+ puts "Presentation Format : " + dp.getPresentationFormat().to_s
34
+ puts "Last Print Date : " + dp.getLastPrinted().to_string
35
+ puts "Is Shared between producers : " + dp.getSharedDoc().to_s
36
+ puts "Subject : " + dp.getSubject().to_s
37
+ puts "Title : " + dp.getTitle().to_s
38
+ end
39
+
40
+ def update_properties()
41
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
42
+
43
+ # Instantiate the Presentation class that represents the presentation
44
+ pres = Rjb::import('com.aspose.slides.Presentation').new(data_dir + "HelloWorld.pptx")
45
+
46
+ # Create a reference to IDocumentProperties object associated with Presentation
47
+ dp = pres.getDocumentProperties()
48
+
49
+ # Set the builtin properties
50
+ dp.setAuthor ("Aspose.Slides for Java")
51
+ dp.setTitle ("Modifying Presentation Properties")
52
+ dp.setSubject ( "Aspose Subject")
53
+ dp.setComments ( "Aspose Description")
54
+ dp.setManager ( "Aspose Manager")
55
+
56
+ # Save your presentation to a file
57
+ save_format = Rjb::import('com.aspose.slides.SaveFormat')
58
+ pres.save(data_dir + "DocProps.pptx", save_format.Pptx)
59
+
60
+ puts "Properties have been updated, Please check output file."
61
+ end
62
+
63
+ def add_custom_properties()
64
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
65
+
66
+ # Instantiate the Presentation class that represents the presentation
67
+ pres = Rjb::import('com.aspose.slides.Presentation').new(data_dir + "HelloWorld.pptx")
68
+
69
+ # Getting Document Properties
70
+ dp = pres.getDocumentProperties()
71
+
72
+ # Adding Custom properties
73
+ dp.set_Item("New Custom" , 12)
74
+ dp.set_Item("My Name","Mudassir")
75
+ dp.set_Item("Custom", 124)
76
+
77
+ # Saving presentation
78
+ save_format = Rjb::import('com.aspose.slides.SaveFormat')
79
+ pres.save(data_dir + "CustomDemo.pptx",save_format.Pptx)
80
+
81
+ puts "Added custom properties, please check output file."
82
+ end
83
+
84
+ def remove_property()
85
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
86
+
87
+ # Instantiate the Presentation class that represents the presentation
88
+ pres = Rjb::import('com.aspose.slides.Presentation').new(data_dir + "HelloWorld.pptx")
89
+
90
+ # Getting Document Properties
91
+ dp = pres.getDocumentProperties()
92
+
93
+ # Getting property name at particular index
94
+ property_name = dp.getPropertyName(2)
95
+
96
+ # Removing selected property
97
+ dp.remove(property_name)
98
+
99
+ # Saving presentation
100
+ save_format = Rjb::import('com.aspose.slides.SaveFormat')
101
+ pres.save(data_dir + "RemoveDP.pptx",save_format.Pptx)
102
+
103
+ puts "Remove document property, please check output file."
104
+ end
105
+ end
106
+ end
@@ -0,0 +1,20 @@
1
+ module Asposeslidesjava
2
+ module Zoom
3
+ def initialize()
4
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
5
+
6
+ # Create an instance of Presentation class
7
+ pres = Rjb::import('com.aspose.slides.Presentation').new
8
+
9
+ # Setting View Properties of Presentation
10
+ #pres.getViewProperties().getSlideViewProperties().setScale(50) # zoom value in percentages for slide view
11
+ pres.getViewProperties().getNotesViewProperties().setScale(50) # .Scale = 50; //zoom value in percentages for notes view
12
+
13
+ # Save the presentation as a PPTX file
14
+ save_format = Rjb::import('com.aspose.slides.SaveFormat')
15
+ pres.save(data_dir + "Zoom.pptx", save_format.Pptx)
16
+
17
+ puts "Set zoom value, please check the output file."
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,60 @@
1
+ module Asposeslidesjava
2
+ module AddEllipseShape
3
+ def initialize()
4
+ # Adding Simple Ellipse in the Slide
5
+ add_simple_ellipse_shape()
6
+
7
+ # Adding Formatted Ellipse in the Slide
8
+ add_formatted_ellipse_shape()
9
+ end
10
+
11
+ def add_simple_ellipse_shape()
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 ellipse type
21
+ sld.getShapes().addAutoShape(Rjb::import('com.aspose.slides.ShapeType').Ellipse, 50, 150, 150, 50)
22
+
23
+ # Write the presentation as a PPTX file
24
+ save_format = Rjb::import('com.aspose.slides.SaveFormat')
25
+ pres.save(data_dir + "SimpleEllipseShape.pptx", save_format.Pptx)
26
+
27
+ puts "Added simple ellipse shape in the slide, please check the output file."
28
+ end
29
+
30
+ def add_formatted_ellipse_shape()
31
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/Shapes/'
32
+
33
+ # Create an instance of Presentation class
34
+ pres = Rjb::import('com.aspose.slides.Presentation').new
35
+
36
+ # Get the first slide
37
+ sld = pres.getSlides().get_Item(0)
38
+
39
+ # Add autoshape of ellipse type
40
+ shp = sld.getShapes().addAutoShape(Rjb::import('com.aspose.slides.ShapeType').Ellipse, 50, 150, 150, 50)
41
+
42
+ # Apply some formatting to ellipse shape
43
+ shp.getFillFormat().setFillType(Rjb::import('com.aspose.slides.FillType').Solid)
44
+ shp.getFillFormat().getSolidFillColor().setColor(Rjb::import('java.awt.Color').new(Rjb::import('com.aspose.slides.PresetColor').Chocolate))
45
+
46
+ # Apply some formatting to the line of Ellipse
47
+ shp.getLineFormat().getFillFormat().setFillType(Rjb::import('com.aspose.slides.FillType').Solid)
48
+ shp.getLineFormat().getFillFormat().getSolidFillColor().setColor(Rjb::import('java.awt.Color').BLACK)
49
+ shp.getLineFormat().setWidth(5)
50
+
51
+ # Write the presentation as a PPTX file
52
+ save_format = Rjb::import('com.aspose.slides.SaveFormat')
53
+ pres.save(data_dir + "FormattedEllipseShape.pptx", save_format.Pptx)
54
+
55
+ puts "Added formatted ellipse shape in the slide, please check the output file."
56
+ end
57
+
58
+
59
+ end
60
+ end
@@ -0,0 +1,65 @@
1
+ module Asposeslidesjava
2
+ module AddingLineShape
3
+ def initialize()
4
+ # Adding Plain Line to Slide
5
+ add_plain_line()
6
+
7
+ # Adding Arrow Shaped Line to Slide
8
+ add_arrow_line()
9
+ end
10
+
11
+ def add_plain_line()
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 an autoshape of type line
21
+ sld.getShapes().addAutoShape(Rjb::import('com.aspose.slides.ShapeType').Line, 50, 150, 300, 0)
22
+
23
+ # Write the presentation as a PPTX file
24
+ save_format = Rjb::import('com.aspose.slides.SaveFormat')
25
+ pres.save(data_dir + "LineShape.pptx", save_format.Pptx)
26
+
27
+ puts "Added plain line to slide, please check the output file."
28
+ end
29
+
30
+ def add_arrow_line()
31
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/Shapes/'
32
+
33
+ # Create an instance of Presentation class
34
+ pres = Rjb::import('com.aspose.slides.Presentation').new
35
+
36
+ # Get the first slide
37
+ sld = pres.getSlides().get_Item(0)
38
+
39
+ # Add an autoshape of type line
40
+ shp = sld.getShapes().addAutoShape(Rjb::import('com.aspose.slides.ShapeType').Line, 50, 150, 300, 0)
41
+
42
+ # Apply some formatting on the line
43
+ shp.getLineFormat().setStyle(Rjb::import('com.aspose.slides.LineStyle').ThickBetweenThin)
44
+ shp.getLineFormat().setWidth(10)
45
+
46
+ shp.getLineFormat().setDashStyle(Rjb::import('com.aspose.slides.LineDashStyle').DashDot)
47
+
48
+ shp.getLineFormat().setBeginArrowheadLength(Rjb::import('com.aspose.slides.LineArrowheadLength').Short)
49
+ shp.getLineFormat().setBeginArrowheadStyle(Rjb::import('com.aspose.slides.LineArrowheadStyle').Oval)
50
+
51
+ shp.getLineFormat().setEndArrowheadLength(Rjb::import('com.aspose.slides.LineArrowheadLength').Long)
52
+ shp.getLineFormat().setEndArrowheadStyle(Rjb::import('com.aspose.slides.LineArrowheadStyle').Triangle)
53
+
54
+ shp.getLineFormat().getFillFormat().setFillType(Rjb::import('com.aspose.slides.FillType').Solid)
55
+ shp.getLineFormat().getFillFormat().getSolidFillColor().setColor(Rjb::import('java.awt.Color').new(Rjb::import('com.aspose.slides.PresetColor').Maroon))
56
+
57
+
58
+ # Write the presentation as a PPTX file
59
+ save_format = Rjb::import('com.aspose.slides.SaveFormat')
60
+ pres.save(data_dir + "ArrowShape.pptx", save_format.Pptx)
61
+
62
+ puts "Added arrow shape line to slide, please check the output file."
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,58 @@
1
+ module Asposeslidesjava
2
+ module AddRectangleShape
3
+ def initialize()
4
+ # Adding Simple Rectangle in the Slide
5
+ add_simple_rectangle_shape()
6
+
7
+ # Adding Formatted Rectangle in the Slide
8
+ add_formatted_rectangle_shape()
9
+ end
10
+
11
+ def add_simple_rectangle_shape()
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
+ sld.getShapes().addAutoShape(Rjb::import('com.aspose.slides.ShapeType').Rectangle, 50, 150, 150, 50)
22
+
23
+ # Write the presentation as a PPTX file
24
+ save_format = Rjb::import('com.aspose.slides.SaveFormat')
25
+ pres.save(data_dir + "SimpleRectangleShape.pptx", save_format.Pptx)
26
+
27
+ puts "Added simple rectangle shape in the slide, please check the output file."
28
+ end
29
+
30
+ def add_formatted_rectangle_shape()
31
+ data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/Shapes/'
32
+
33
+ # Create an instance of Presentation class
34
+ pres = Rjb::import('com.aspose.slides.Presentation').new
35
+
36
+ # Get the first slide
37
+ sld = pres.getSlides().get_Item(0)
38
+
39
+ # Add autoshape of rectangle type
40
+ shp = sld.getShapes().addAutoShape(Rjb::import('com.aspose.slides.ShapeType').Rectangle, 50, 150, 150, 50)
41
+
42
+ # Apply some formatting to rectangle shape
43
+ shp.getFillFormat().setFillType(Rjb::import('com.aspose.slides.FillType').Solid)
44
+ shp.getFillFormat().getSolidFillColor().setColor(Rjb::import('java.awt.Color').new(Rjb::import('com.aspose.slides.PresetColor').Chocolate))
45
+
46
+ # Apply some formatting to the line of Rectangle
47
+ shp.getLineFormat().getFillFormat().setFillType(Rjb::import('com.aspose.slides.FillType').Solid)
48
+ shp.getLineFormat().getFillFormat().getSolidFillColor().setColor(Rjb::import('java.awt.Color').BLACK)
49
+ shp.getLineFormat().setWidth(5)
50
+
51
+ # Write the presentation as a PPTX file
52
+ save_format = Rjb::import('com.aspose.slides.SaveFormat')
53
+ pres.save(data_dir + "FormattedRectangleShape.pptx", save_format.Pptx)
54
+
55
+ puts "Added formatted rectangle shape in the slide, please check the output file."
56
+ end
57
+ end
58
+ end