Module: Asposeslidesjava::AddEllipseShape

Defined in:
lib/asposeslidesjava/Shapes/addellipseshape.rb

Instance Method Summary collapse

Instance Method Details

#add_formatted_ellipse_shapeObject



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/asposeslidesjava/Shapes/addellipseshape.rb', line 30

def add_formatted_ellipse_shape()    
    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

    # Get the first slide
    sld = pres.getSlides().get_Item(0)

    # Add autoshape of ellipse type
    shp = sld.getShapes().addAutoShape(Rjb::import('com.aspose.slides.ShapeType').Ellipse, 50, 150, 150, 50)

    # Apply some formatting to ellipse shape
    shp.getFillFormat().setFillType(Rjb::import('com.aspose.slides.FillType').Solid)
    shp.getFillFormat().getSolidFillColor().setColor(Rjb::import('java.awt.Color').new(Rjb::import('com.aspose.slides.PresetColor').Chocolate))

    # Apply some formatting to the line of Ellipse
    shp.getLineFormat().getFillFormat().setFillType(Rjb::import('com.aspose.slides.FillType').Solid)
    shp.getLineFormat().getFillFormat().getSolidFillColor().setColor(Rjb::import('java.awt.Color').BLACK)
    shp.getLineFormat().setWidth(5)

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

    puts "Added formatted ellipse shape in the slide, please check the output file."
end

#add_simple_ellipse_shapeObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/asposeslidesjava/Shapes/addellipseshape.rb', line 11

def add_simple_ellipse_shape()    
    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

    # Get the first slide
    sld = pres.getSlides().get_Item(0)

    # Add autoshape of ellipse type
    sld.getShapes().addAutoShape(Rjb::import('com.aspose.slides.ShapeType').Ellipse, 50, 150, 150, 50)

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

    puts "Added simple ellipse shape in the slide, please check the output file."
end

#initializeObject



3
4
5
6
7
8
9
# File 'lib/asposeslidesjava/Shapes/addellipseshape.rb', line 3

def initialize()
    # Adding Simple Ellipse in the Slide
    add_simple_ellipse_shape()

    # Adding Formatted Ellipse in the Slide
    add_formatted_ellipse_shape()
end