3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/asposeslidesjava/helloworld.rb', line 3
def initialize()
data_dir = File.dirname(File.dirname(File.dirname(__FILE__))) + '/data/'
pres = Rjb::import('com.aspose.slides.Presentation').new
slide = pres.getSlides().get_Item(0)
shape_type = Rjb::import('com.aspose.slides.ShapeType')
ashp = slide.getShapes().addAutoShape(shape_type.Rectangle, 150, 75, 150, 50)
ashp.addTextFrame("Hello World")
fill_type = Rjb::import('com.aspose.slides.FillType')
color = Rjb::import('java.awt.Color')
ashp.getTextFrame().getParagraphs().get_Item(0).getPortions().get_Item(0).getPortionFormat().getFillFormat().setFillType(fill_type.Solid)
ashp.getTextFrame().getParagraphs().get_Item(0).getPortions().get_Item(0).getPortionFormat().getFillFormat().getSolidFillColor().setColor(color.BLACK)
ashp.getShapeStyle().getLineColor().setColor(color.WHITE)
ashp.getFillFormat().setFillType (fill_type.NoFill)
save_format = Rjb::import('com.aspose.slides.SaveFormat')
pres.save(data_dir + "HelloWorld.pptx", save_format.Pptx)
puts "Document has been saved, please check the output file."
end
|