Sha256: 6abaec6aa61110a6a76c6457eb7d066f016a4c4b4186d8997cf11d25a71dd823

Contents?: true

Size: 1.55 KB

Versions: 2

Compression:

Stored size: 1.55 KB

Contents

module Asposeslidesjava
  module GroupShape
    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
        sld = pres.getSlides().get_Item(0)

        # Accessing the shape collection of slides
        slide_shapes = sld.getShapes()

        # Adding a group shape to the slide
        group_shape = slide_shapes.addGroupShape()

        # Adding shapes inside Added group shape
        shape_type = Rjb::import('com.aspose.slides.ShapeType')
        group_shape.getShapes().addAutoShape(shape_type.Rectangle, 300, 100, 100, 100)
        group_shape.getShapes().addAutoShape(shape_type.Rectangle, 500, 100, 100, 100)
        group_shape.getShapes().addAutoShape(shape_type.Rectangle, 300, 300, 100, 100)
        group_shape.getShapes().addAutoShape(shape_type.Rectangle, 500, 300, 100, 100)

        # Adding group shape frame
        group_shape.setFrame(Rjb::import('com.aspose.slides.ShapeFrame').new(100, 300, 500, 40, Rjb::import('com.aspose.slides.NullableBool').False, Rjb::import('com.aspose.slides.NullableBool').False, 0))

        # Write the presentation as a PPTX file 
        save_format = Rjb::import('com.aspose.slides.SaveFormat')
        pres.save(data_dir + "GroupShape.pptx", save_format.Pptx)

        puts "Added group shape, please check the output file."
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
asposeslidesjava-0.0.2 lib/asposeslidesjava/Shapes/groupshape.rb
asposeslidesjava-0.0.1 lib/asposeslidesjava/Shapes/groupshape.rb