Module: Asposeslidesjava::AccessSlides

Defined in:
lib/asposeslidesjava/Slides/accessslides.rb

Instance Method Summary collapse

Instance Method Details

#get_slide_by_idObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/asposeslidesjava/Slides/accessslides.rb', line 23

def get_slide_by_id()
    data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
            
    # Instantiate Presentation class that represents the presentation file
    pres = Rjb::import('com.aspose.slides.Presentation').new(data_dir + 'Aspose.pptx')

    # Getting Slide ID
    id = pres.getSlides().get_Item(0).getSlideId()
        
    # Accessing Slide by ID
    slide = pres.getSlideById(id)

    puts "Slide: " + slide.to_string
end

#get_slide_by_indexObject



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/asposeslidesjava/Slides/accessslides.rb', line 11

def get_slide_by_index()
    data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
            
    # Instantiate Presentation class that represents the presentation file
    pres = Rjb::import('com.aspose.slides.Presentation').new(data_dir + 'Aspose.pptx')

    # Accessing a slide using its slide index
    slide = pres.getSlides().get_Item(0)

    puts "Slide: " + slide.to_string
end

#initializeObject



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

def initialize()
    # Using Slides Collection to Access Slide by Index
    get_slide_by_index()

    # Using Slides Collection to Access Slide by ID
    get_slide_by_id()
end