Class: Aspose::Cloud::Cells::TextEditor
- Inherits:
-
Object
- Object
- Aspose::Cloud::Cells::TextEditor
- Defined in:
- lib/Cells/text_editor.rb
Instance Method Summary collapse
- #find_text(text, folder_name = '', storage_type = 'Aspose', storage_name = '') ⇒ Object
- #find_text_in_worksheet(text, worksheet_name, folder_name = '', storage_type = 'Aspose', storage_name = '') ⇒ Object
- #get_text_items(folder_name = '', storage_type = 'Aspose', storage_name = '') ⇒ Object
- #get_text_items_in_worksheet(worksheet_name, folder_name = '', storage_type = 'Aspose', storage_name = '') ⇒ Object
-
#initialize(filename) ⇒ TextEditor
constructor
A new instance of TextEditor.
- #replace_text(old_text, new_text, folder_name = '', storage_type = 'Aspose', storage_name = '') ⇒ Object
- #replace_text_in_worksheet(worksheet_name, old_text, new_text, folder_name = '', storage_type = 'Aspose', storage_name = '') ⇒ Object
Constructor Details
#initialize(filename) ⇒ TextEditor
Returns a new instance of TextEditor.
22 23 24 25 26 |
# File 'lib/Cells/text_editor.rb', line 22 def initialize(filename) @filename = filename raise 'filename not specified.' if filename.empty? @base_uri = "#{Aspose::Cloud::Common::Product.product_uri}/cells/#{@filename}" end |
Instance Method Details
#find_text(text, folder_name = '', storage_type = 'Aspose', storage_name = '') ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/Cells/text_editor.rb', line 28 def find_text(text, folder_name='', storage_type = 'Aspose', storage_name = '') raise 'text not specified.' if text.empty? str_uri = "#{@base_uri}/findText?text=#{text}" str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type) signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri) JSON.parse(RestClient.post(signed_str_uri, '', {:accept=>'application/json'}))['TextItems']['TextItemList'] end |
#find_text_in_worksheet(text, worksheet_name, folder_name = '', storage_type = 'Aspose', storage_name = '') ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'lib/Cells/text_editor.rb', line 37 def find_text_in_worksheet(text, worksheet_name, folder_name='', storage_type = 'Aspose', storage_name = '') raise 'text not specified.' if text.empty? raise 'worksheet_name not specified.' if worksheet_name.empty? str_uri = "#{@base_uri}/worksheets/#{worksheet_name}/findText?text=#{text}" str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type) signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri) JSON.parse(RestClient.post(signed_str_uri, '', {:accept=>'application/json'}))['TextItems']['TextItemList'] end |
#get_text_items(folder_name = '', storage_type = 'Aspose', storage_name = '') ⇒ Object
47 48 49 50 51 52 |
# File 'lib/Cells/text_editor.rb', line 47 def get_text_items(folder_name='', storage_type = 'Aspose', storage_name = '') str_uri = "#{@base_uri}/textItems" str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type) signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri) JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['TextItems']['TextItemList'] end |
#get_text_items_in_worksheet(worksheet_name, folder_name = '', storage_type = 'Aspose', storage_name = '') ⇒ Object
54 55 56 57 58 59 60 61 |
# File 'lib/Cells/text_editor.rb', line 54 def get_text_items_in_worksheet(worksheet_name, folder_name='', storage_type = 'Aspose', storage_name = '') raise 'worksheet_name not specified.' if worksheet_name.empty? str_uri = "#{@base_uri}/worksheets/#{worksheet_name}/textItems" str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type) signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri) JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['TextItems']['TextItemList'] end |
#replace_text(old_text, new_text, folder_name = '', storage_type = 'Aspose', storage_name = '') ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/Cells/text_editor.rb', line 63 def replace_text(old_text, new_text, folder_name = '', storage_type = 'Aspose', storage_name = '') raise 'old_text not specified.' if old_text.empty? raise 'new_text not specified.' if new_text.empty? str_uri = "#{@base_uri}/replaceText" qry = Hash.new qry[:oldValue] = old_text qry[:newValue] = new_text str_uri = Aspose::Cloud::Common::Utils.build_uri(str_uri,qry) str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type) signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri) response_stream = RestClient.post(signed_str_uri,'',{ :accept => 'application/json' }) valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream) valid_output.empty? ? true : valid_output end |
#replace_text_in_worksheet(worksheet_name, old_text, new_text, folder_name = '', storage_type = 'Aspose', storage_name = '') ⇒ Object
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/Cells/text_editor.rb', line 80 def replace_text_in_worksheet(worksheet_name, old_text, new_text, folder_name = '', storage_type = 'Aspose', storage_name = '') raise 'worksheet_name not specified.' if worksheet_name.empty? raise 'old_text not specified.' if old_text.empty? raise 'new_text not specified.' if new_text.empty? str_uri = "#{@base_uri}/worksheets/#{worksheet_name}/replaceText" qry = Hash.new qry[:oldValue] = old_text qry[:newValue] = new_text str_uri = Aspose::Cloud::Common::Utils.build_uri(str_uri,qry) str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type) signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri) response_stream = RestClient.post(signed_str_uri,'',{ :accept => 'application/json' }) valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream) valid_output.empty? ? true : valid_output end |