Method: Aspose::Cloud::Cells::Workbook#set_property

Defined in:
lib/Cells/workbook.rb

#set_property(property_name = '', property_value = '') ⇒ Object



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
84
85
# File 'lib/Cells/workbook.rb', line 54

def set_property property_name='',property_value=''
  begin
    if @filename == ''
      raise 'Base file name not specified.'
    end
    if property_name == ''
      raise 'Property name is not specified.'
    end
    if property_value == ''
      raise 'Property Value is not specified.'
    end
    str_uri = $product_uri + '/cells/' + @filename + '/documentProperties/' + property_name
    put_data_arr = Hash.new
    put_data_arr['Link'] = nil
    put_data_arr['Name'] = property_name
    put_data_arr['Value'] = property_value
    put_data_arr['BuiltIn'] = 'False'
    json_data = put_data_arr.to_json
    signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
    response = RestClient.put(signed_uri,json_data, :accept => 'application/json')
    json = JSON.parse(response)
    if json['Code'] == 200
      return json['DocumentProperty']
    else
      return false
    end

  rescue Exception=>e
    print e
  end
      
end