class Aspose::Cloud::Cells::Convertor
This class provides functionality for converting Excel Spreadsheets to other supported formats.
Public Class Methods
Public Instance Methods
autoshape_to_image(shape_index,image_format)
click to toggle source
# File lib/Cells/convertor.rb, line 195 def autoshape_to_image shape_index,image_format begin if @filename=='' raise 'Base File is not specified' end if @worksheet_name=='' raise 'Worksheet is not specified' end str_uri = $product_uri + '/cells/' + @filename + '/worksheets/' + @worksheet_name + '/autoshapes/' + shape_index.to_s + '?format=' + image_format.to_s; signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri) response = RestClient.get(signed_uri, :accept => 'application/json') v_output = Aspose::Cloud::Common::Utils.validate_output(response) if v_output==nil || v_output=='' outputpath=$out_put_location + Aspose::Cloud::Common::Utils.get_filename(@filename) + '_' + @worksheet_name + '.' + image_format Aspose::Cloud::Common::Utils.save_file(response, outputpath) return outputpath else return v_output end rescue Exception=>e print e end end
chart_to_image(chart_index,image_format)
click to toggle source
# File lib/Cells/convertor.rb, line 168 def chart_to_image chart_index,image_format begin if @filename=='' raise 'Base File is not specified' end if @worksheet_name=='' raise 'Worksheet is not specified' end str_uri = $product_uri + '/cells/' + @filename + '/worksheets/' + @worksheet_name + '/charts/' + chart_index.to_s + '?format=' + image_format.to_s; signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri) response = RestClient.get(signed_uri, :accept => 'application/json') v_output = Aspose::Cloud::Common::Utils.validate_output(response) if v_output==nil || v_output=='' outputpath=$out_put_location + Aspose::Cloud::Common::Utils.get_filename(@filename) + '_' + @worksheet_name + '.' + image_format Aspose::Cloud::Common::Utils.save_file(response, outputpath) return outputpath else return v_output end rescue Exception=>e print e end end
convert(local_file,save_format)
click to toggle source
Converts the file available at Aspose
Storage and saves converted file locally.
-
:localFile represents converted local file path and name
-
:saveFormat represents the converted format. For a list of supported formats, please visit
http://aspose.com/docs/display/cells/workbook
# File lib/Cells/convertor.rb, line 23 def convert local_file,save_format begin if @filename == '' raise 'Base file is not specified' end url_doc = $product_uri + '/cells/' + @filename + '?format=' + save_format signed_url = Aspose::Cloud::Common::Utils.sign(url_doc) response = RestClient.get(signed_url, :accept => 'application/json') validate_output = Aspose::Cloud::Common::Utils.validate_output(response) if validate_output!=nil || validate_output!='' output = $out_put_location + local_file + '.' + save_format Aspose::Cloud::Common::Utils.save_file(response, output) return output else return validate_output end rescue Exception=>e print e end end
convert_to_image(image_format,worksheet_name)
click to toggle source
# File lib/Cells/convertor.rb, line 44 def convert_to_image image_format,worksheet_name begin if @filename == '' raise 'Base File is not specified.' end str_uri = $product_uri + '/cells/' + @filename + '/worksheets/' + worksheet_name.to_s + '?format=' + image_format.to_s signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri) response = RestClient.get(signed_uri,:accept => 'application/json') validate_output = Aspose::Cloud::Common::Utils.validate_output(response) if validate_output!=nil || validate_output!='' output = $out_put_location + worksheet_name + '.' + image_format Aspose::Cloud::Common::Utils.save_file(response, output); return output else return validate_output end rescue Exception=>e print e end end
oleobject_to_image(object_index,image_format)
click to toggle source
# File lib/Cells/convertor.rb, line 142 def oleobject_to_image object_index,image_format begin if @filename=='' raise 'Base File is not specified' end if @worksheet_name=='' raise 'Worksheet is not specified' end str_uri = $product_uri + '/cells/' + @filename + '/worksheets/' + @worksheet_name + '/oleobjects/' + object_index.to_s + '?format=' + image_format.to_s; signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri) response = RestClient.get(signed_uri, :accept => 'application/json') v_output = Aspose::Cloud::Common::Utils.validate_output(response) if v_output==nil || v_output=='' outputpath=$out_put_location + Aspose::Cloud::Common::Utils.get_filename(@filename) + '_' + @worksheet_name + '.' + image_format Aspose::Cloud::Common::Utils.save_file(response, outputpath) return outputpath else return v_output end rescue Exception=>e print e end end
picture_to_image(picture_index,image_format)
click to toggle source
# File lib/Cells/convertor.rb, line 115 def picture_to_image picture_index,image_format begin if @filename=='' raise 'Base File is not specified' end if @worksheet_name=='' raise 'Worksheet is not specified' end str_uri = $product_uri + '/cells/' + @filename + '/worksheets/' + @worksheet_name + '/pictures/' + picture_index.to_s + '?format=' + image_format.to_s; signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri) response = RestClient.get(signed_uri, :accept => 'application/json') v_output = Aspose::Cloud::Common::Utils.validate_output(response) if v_output==nil || v_output=='' outputpath=$out_put_location + Aspose::Cloud::Common::Utils.get_filename(@filename) + '_' + @worksheet_name + '.' + image_format Aspose::Cloud::Common::Utils.save_file(response, outputpath) return outputpath else return v_output end rescue Exception=>e print e end end
save(output_format)
click to toggle source
# File lib/Cells/convertor.rb, line 66 def save output_format begin if @filename=='' raise 'Base File is not specified.' end str_uri = $product_uri + '/cells/' + @filename + '?format=' + output_format.to_s signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri) response = RestClient.get(signed_uri,:accept => 'application/json') validate_output = Aspose::Cloud::Common::Utils.validate_output(response) if validate_output==nil || validate_output=='' output = $out_put_location + Aspose::Cloud::Common::Utils.get_filename(@filename) + '.' + output_format Aspose::Cloud::Common::Utils.save_file(response, output); return output else return validate_output end rescue Exception=>e print e end end
worksheet_to_image(image_format)
click to toggle source
# File lib/Cells/convertor.rb, line 89 def worksheet_to_image image_format begin if @filename=='' raise 'Base file name is not specified.' end if @worksheet_name == '' raise 'Worksheet is not specified' end str_uri = $product_uri + '/cells/' + @filename + '/worksheets/' + @worksheet_name + '?format=' + image_format.to_s signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri) response = RestClient.get(signed_uri,:accept => 'application/json') v_output = Aspose::Cloud::Common::Utils.validate_output(response) if v_output==nil || v_output=='' outputpath=$out_put_location + Aspose::Cloud::Common::Utils.get_filename(@filename) + '_' + @worksheet_name + '.' + image_format Aspose::Cloud::Common::Utils.save_file(response, outputpath) return outputpath else return v_output end rescue Exception=>e print e end end