Module: Asposeslidesjava::FindShape
- Defined in:
- lib/asposeslidesjava/Shapes/findshape.rb
Instance Method Summary collapse
Instance Method Details
#find_shape(slide, alttext) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/asposeslidesjava/Shapes/findshape.rb', line 17 def find_shape(, alttext) #Iterating through all shapes inside the slide i = 0 while i < .getShapes().size() # If the alternative text of the slide matches with the required one then return the shape if .getShapes().get_Item(i).getAlternativeText() == alttext return .getShapes().get_Item(i) end i +=1 end return nil end |
#initialize ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/asposeslidesjava/Shapes/findshape.rb', line 3 def initialize() data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/Shapes/' # Create an instance of Presentation class pres = Rjb::import('com.aspose.slides.Presentation').new(data_dir + 'demo.pptx') # Get the first slide = pres.getSlides().get_Item(0) shape = find_shape(, "Shape1") puts "Shape: " + shape.to_string end |