Sha256: 2e2f811ad77b60a7e1abe174605a7942778ddcdb4f96cb25810d4c53fa32f29e

Contents?: true

Size: 927 Bytes

Versions: 2

Compression:

Stored size: 927 Bytes

Contents

module Asposeslidesjava
  module OleObject
    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 + 'OleEmbed.pptx')

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

        # Cast the shape to OleObjectFrameEx
        oof = sld.getShapes().get_Item(0)

        # Read the OLE Object and write it to disk
        if oof != nil
            fstr = Rjb::import('java.io.FileOutputStream').new(data_dir + "excelFromOLEObject.xlsx")
            buf = oof.getObjectData()
            fstr.write(buf, 0, buf.length)
            fstr.flush()
            fstr.close()
            puts "Excel OLE Object written as excelFromOLEObject.xlsx file"
        end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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