Method: Aspose::Cloud::Cells::Workbook#encrypt_workbook

Defined in:
lib/Cells/workbook.rb

#encrypt_workbook(encryption_type = 'XOR', password = '', key_length = '') ⇒ Object



240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
# File 'lib/Cells/workbook.rb', line 240

def encrypt_workbook encryption_type='XOR',password='',key_length=''
  begin
    if @filename == ''
      raise 'Base file name not specified'
    end
    fields_array = Hash.new
    fields_array['EncriptionType'] = encryption_type
    fields_array['KeyLength'] = key_length
    fields_array['Password'] = password
    json_data = fields_array.to_json
    str_uri = $product_uri + '/cells/' + @filename + '/encryption'
    signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
    response = RestClient.post(signed_uri, json_data,:accept => 'application/json')
    json = JSON.parse(response)
    if json['Code']==200
      return true
    else
      return false
    end
  rescue Exception=>e
    print e
  end
end