Method: Aspose::Cloud::Words::Extractor#get_ole_data

Defined in:
lib/Words/extractor.rb

#get_ole_data(index, ole_format) ⇒ Object

Get the OLE drawing object from document

@param number index
@param string ole_format


48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/Words/extractor.rb', line 48

def get_ole_data index, ole_format
      
  begin

    if @filename == ''
      raise 'Base file not specified.'
    end

    if index == ''
      raise 'Index not specified.'
    end

    if ole_format == ''
      raise 'OLE Format not specified.'
    end

    str_uri = $product_uri + '/words/' + @filename + '/drawingObjects/' + index.to_s + '/oleData'
    signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
    response_stream = RestClient.get(signed_str_uri,{:accept=>'application/json'})

    valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)

    if valid_output == ''                    
  
      output_path = $out_put_location + Aspose::Cloud::Common::Utils.get_filename(@filename) + '_' + index.to_s + '.' + ole_format
      Aspose::Cloud::Common::Utils.save_file(response_stream,output_path)
      return output_path
    else
      return valid_output
    end

  rescue Exception=>e
    print e
  end
      
end