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
|
# File 'lib/asposeslidesjava/Shapes/cloneshape.rb', line 3
def initialize()
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/Shapes/'
srcPres = Rjb::import('com.aspose.slides.Presentation').new(data_dir + 'demo.pptx')
sourceShapes = srcPres.getSlides().get_Item(0).getShapes()
blankLayout = srcPres.getMasters().get_Item(0).getLayoutSlides().getByType(Rjb::import('com.aspose.slides.SlideLayoutType').Blank)
destSlide = srcPres.getSlides().addEmptySlide(blankLayout)
destShapes = destSlide.getShapes()
destShapes.addClone(sourceShapes.get_Item(1), 50, 150 + sourceShapes.get_Item(0).getHeight())
destShapes.addClone(sourceShapes.get_Item(2))
destShapes.addClone(sourceShapes.get_Item(3), 50, 200, 50, 50)
destShapes.insertClone(0, sourceShapes.get_Item(0), 50, 150)
save_format = Rjb::import('com.aspose.slides.SaveFormat')
srcPres.save(data_dir + "CloneShape.pptx", save_format.Pptx)
puts "Cloned shape, please check the output file."
end
|