asposecloud 1.0.0 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. data/README.md +31 -9
  2. data/Tests/Barcode/builder_tests.rb +95 -0
  3. data/Tests/Barcode/reader_tests.rb +70 -0
  4. data/Tests/Cells/charteditor_tests.rb +139 -0
  5. data/Tests/Cells/converter_tests.rb +83 -0
  6. data/Tests/Cells/extractor_tests.rb +40 -0
  7. data/Tests/Cells/texteditor_tests.rb +52 -0
  8. data/Tests/Cells/workbook_tests.rb +167 -0
  9. data/Tests/Cells/worksheet_tests.rb +435 -0
  10. data/Tests/Data/barcodeQR.bmp +0 -0
  11. data/Tests/Data/barcodeQR.jpg +0 -0
  12. data/Tests/Data/barcodeQR.tiff +0 -0
  13. data/Tests/Data/bizcard.psd +0 -0
  14. data/Tests/Data/macbook.gif +0 -0
  15. data/Tests/Data/mail_merge_regions.docx +0 -0
  16. data/Tests/Data/mail_merge_template.docx +0 -0
  17. data/Tests/Data/test_cells.xlsx +0 -0
  18. data/Tests/Data/test_multi_pages.docx +0 -0
  19. data/Tests/Data/test_slides.pptx +0 -0
  20. data/Tests/Email/converter_tests.rb +30 -0
  21. data/Tests/Email/document_tests.rb +55 -0
  22. data/Tests/Imaging/converter_tests.rb +32 -0
  23. data/Tests/Imaging/document_tests.rb +132 -0
  24. data/Tests/Imaging/extractor_tests.rb +67 -0
  25. data/Tests/Imaging/image_tests.rb +55 -0
  26. data/Tests/Ocr/extractor_tests.rb +34 -0
  27. data/Tests/Pdf/annotationeditor_tests.rb +128 -0
  28. data/Tests/Pdf/converter_tests.rb +74 -0
  29. data/Tests/Pdf/document_tests.rb +285 -0
  30. data/Tests/Pdf/extractor_tests.rb +37 -0
  31. data/Tests/Pdf/texteditor_tests.rb +84 -0
  32. data/Tests/Slides/converter_tests.rb +59 -0
  33. data/Tests/Slides/document_tests.rb +187 -0
  34. data/Tests/Slides/extractor_tests.rb +92 -0
  35. data/Tests/Storage/folder_tests.rb +64 -0
  36. data/Tests/Tasks/assignments_tests.rb +44 -0
  37. data/Tests/Tasks/calendar_tests.rb +45 -0
  38. data/Tests/Tasks/converter_tests.rb +32 -0
  39. data/Tests/Tasks/document_tests.rb +114 -0
  40. data/Tests/Tasks/resources_tests.rb +44 -0
  41. data/Tests/Words/builder_tests.rb +56 -0
  42. data/Tests/Words/converter_tests.rb +54 -0
  43. data/Tests/Words/document_tests.rb +208 -0
  44. data/Tests/Words/extractor_tests.rb +120 -0
  45. data/Tests/Words/mail_merge_tests.rb +120 -0
  46. data/Tests/setup.json +6 -0
  47. data/lib/Barcode/builder.rb +270 -20
  48. data/lib/Barcode/reader.rb +112 -18
  49. data/lib/Cells/chart_editor.rb +102 -0
  50. data/lib/Cells/convertor.rb +22 -2
  51. data/lib/Cells/text_editor.rb +8 -2
  52. data/lib/Cells/workbook.rb +63 -3
  53. data/lib/Cells/worksheet.rb +479 -10
  54. data/lib/Common/utils.rb +2 -0
  55. data/lib/Email/converter.rb +2 -18
  56. data/lib/Email/document.rb +32 -17
  57. data/lib/Ocr/extractor.rb +26 -20
  58. data/lib/Pdf/annotation_editor.rb +0 -17
  59. data/lib/Pdf/converter.rb +25 -17
  60. data/lib/Pdf/document.rb +167 -23
  61. data/lib/Pdf/extractor.rb +0 -17
  62. data/lib/Pdf/text_editor.rb +35 -20
  63. data/lib/Slides/converter.rb +48 -18
  64. data/lib/Slides/document.rb +186 -51
  65. data/lib/Slides/extractor.rb +35 -18
  66. data/lib/Storage/folder.rb +30 -25
  67. data/lib/Words/builder.rb +23 -29
  68. data/lib/Words/converter.rb +30 -17
  69. data/lib/Words/document.rb +336 -28
  70. data/lib/Words/extractor.rb +112 -33
  71. data/lib/Words/mail_merge.rb +2 -20
  72. data/{Tests/word_tests.rb → lib/aspose_imaging.rb} +5 -17
  73. data/lib/asposecloud.rb +3 -1
  74. data/lib/asposecloud/version.rb +1 -1
  75. data/lib/imaging/converter.rb +55 -0
  76. data/lib/imaging/document.rb +301 -0
  77. data/lib/imaging/extractor.rb +165 -0
  78. data/lib/imaging/image.rb +118 -0
  79. data/lib/restclient.rb +36 -0
  80. data/lib/tasks/assignments.rb +19 -19
  81. data/lib/tasks/calendar.rb +27 -19
  82. data/lib/tasks/converter.rb +4 -17
  83. data/lib/tasks/document.rb +79 -22
  84. data/lib/tasks/resources.rb +18 -18
  85. metadata +70 -19
  86. checksums.yaml +0 -7
  87. data/Tests/barcode_tests.rb +0 -45
  88. data/Tests/cell_tests.rb +0 -41
  89. data/Tests/email_tests.rb +0 -43
  90. data/Tests/pdf_tests.rb +0 -76
  91. data/Tests/slide_tests.rb +0 -41
  92. data/Tests/storage_tests.rb +0 -86
  93. data/Tests/tasks_tests.rb +0 -24
@@ -0,0 +1,40 @@
1
+
2
+ require 'test/unit'
3
+ require_relative '../../lib/asposecloud'
4
+
5
+ class ExtractorTests < Test::Unit::TestCase
6
+
7
+ def setup
8
+ file = File.read('../setup.json')
9
+ data = JSON.parse(file)
10
+
11
+ Aspose::Cloud::Common::AsposeApp.app_key = data['app_key']
12
+ Aspose::Cloud::Common::AsposeApp.app_sid = data['app_sid']
13
+ Aspose::Cloud::Common::AsposeApp.output_location = data['output_location']
14
+ Aspose::Cloud::Common::Product.set_base_product_uri(data['product_uri'])
15
+ end
16
+
17
+ def test_get_picture
18
+ extractor = Aspose::Cloud::Cells::Extractor.new('test_cells.xlsx')
19
+ result = extractor.get_picture(worksheet_name='Sheet2', picture_index=0, image_format='png')
20
+ assert_equal true, File.exist?('../Output/test_cells_Sheet2.png')
21
+ end
22
+
23
+ def test_get_ole_object
24
+ extractor = Aspose::Cloud::Cells::Extractor.new('test_cells.xlsx')
25
+ result = extractor.get_ole_object(worksheet_name='Sheet2', object_index=1, image_format='jpg')
26
+ assert_equal true, File.exist?('../Output/test_cells_Sheet2.jpg')
27
+ end
28
+
29
+ def test_get_chart
30
+ extractor = Aspose::Cloud::Cells::Extractor.new('test_cells.xlsx')
31
+ result = extractor.get_chart(worksheet_name='Sheet2', chart_index=0, image_format='tiff')
32
+ assert_equal true, File.exist?('../Output/test_cells_Sheet2.tiff')
33
+ end
34
+
35
+ def test_get_auto_shape
36
+ extractor = Aspose::Cloud::Cells::Extractor.new('test_cells.xlsx')
37
+ result = extractor.get_auto_shape(worksheet_name='Sheet2', shape_index=1, image_format='tiff')
38
+ assert_equal true, File.exist?('../Output/test_cells_Sheet2.tiff')
39
+ end
40
+ end
@@ -0,0 +1,52 @@
1
+
2
+ require 'test/unit'
3
+ require_relative '../../lib/asposecloud'
4
+
5
+ class TextEditorTests < Test::Unit::TestCase
6
+
7
+ def setup
8
+ file = File.read('../setup.json')
9
+ data = JSON.parse(file)
10
+
11
+ Aspose::Cloud::Common::AsposeApp.app_key = data['app_key']
12
+ Aspose::Cloud::Common::AsposeApp.app_sid = data['app_sid']
13
+ Aspose::Cloud::Common::AsposeApp.output_location = data['output_location']
14
+ Aspose::Cloud::Common::Product.set_base_product_uri(data['product_uri'])
15
+ end
16
+
17
+ def test_find_text
18
+ text_editor = Aspose::Cloud::Cells::TextEditor.new('test_cells.xlsx')
19
+ response = text_editor.find_text(text='Aspose')
20
+ assert_instance_of(Array,response)
21
+ end
22
+
23
+ def test_find_text_in_worksheet
24
+ text_editor = Aspose::Cloud::Cells::TextEditor.new('test_cells.xlsx')
25
+ response = text_editor.find_text_in_worksheet(text='Aspose', worksheet_name='Sheet3')
26
+ assert_instance_of(Array,response)
27
+ end
28
+
29
+ def test_get_text_items
30
+ text_editor = Aspose::Cloud::Cells::TextEditor.new('test_cells.xlsx')
31
+ response = text_editor.get_text_items()
32
+ assert_instance_of(Array,response)
33
+ end
34
+
35
+ def test_get_text_items_in_worksheet
36
+ text_editor = Aspose::Cloud::Cells::TextEditor.new('test_cells.xlsx')
37
+ response = text_editor.get_text_items_in_worksheet(worksheet_name='Sheet3')
38
+ assert_instance_of(Array,response)
39
+ end
40
+
41
+ def test_replace_text
42
+ text_editor = Aspose::Cloud::Cells::TextEditor.new('test_cells.xlsx')
43
+ result = text_editor.replace_text(old_text='Aspose', new_text='Banckle')
44
+ assert_equal true, result
45
+ end
46
+
47
+ def test_replace_text_in_worksheet
48
+ text_editor = Aspose::Cloud::Cells::TextEditor.new('test_cells.xlsx')
49
+ result = text_editor.replace_text_in_worksheet(worksheet_name='Sheet3', old_text='Banckle', new_text='Aspose')
50
+ assert_equal true, result
51
+ end
52
+ end
@@ -0,0 +1,167 @@
1
+
2
+ require 'test/unit'
3
+ require_relative '../../lib/asposecloud'
4
+
5
+ class WorkbookTests < Test::Unit::TestCase
6
+
7
+ def setup
8
+ file = File.read('../setup.json')
9
+ data = JSON.parse(file)
10
+
11
+ Aspose::Cloud::Common::AsposeApp.app_key = data['app_key']
12
+ Aspose::Cloud::Common::AsposeApp.app_sid = data['app_sid']
13
+ Aspose::Cloud::Common::AsposeApp.output_location = data['output_location']
14
+ Aspose::Cloud::Common::Product.set_base_product_uri(data['product_uri'])
15
+ end
16
+
17
+ def test_get_properties
18
+ workbook = Aspose::Cloud::Cells::Workbook.new('test_cells.xlsx')
19
+ response = workbook.get_properties()
20
+ assert_instance_of(Array,response)
21
+ end
22
+
23
+ def test_get_property
24
+ workbook = Aspose::Cloud::Cells::Workbook.new('test_cells.xlsx')
25
+ response = workbook.get_property(property_name='Author')
26
+ assert_instance_of(Hash,response)
27
+ end
28
+
29
+ def test_set_property
30
+ workbook = Aspose::Cloud::Cells::Workbook.new('test_cells.xlsx')
31
+ response = workbook.set_property(property_name='Test', property_value='123')
32
+ assert_instance_of(Hash,response)
33
+ end
34
+
35
+ def test_remove_all_properties
36
+ workbook = Aspose::Cloud::Cells::Workbook.new('test_cells.xlsx')
37
+ response = workbook.remove_all_properties()
38
+ assert_equal true, response
39
+ end
40
+
41
+ def test_remove_property
42
+ workbook = Aspose::Cloud::Cells::Workbook.new('test_cells.xlsx')
43
+ response = workbook.remove_property(property_name='Test')
44
+ assert_equal true, response
45
+ end
46
+
47
+ def test_create_empty_workbook
48
+ workbook = Aspose::Cloud::Cells::Workbook.new('test_cells_empty.xlsx')
49
+ response = workbook.create_empty_workbook()
50
+ assert_instance_of(Hash,response)
51
+ end
52
+
53
+ def test_create_workbook_from_template
54
+ workbook = Aspose::Cloud::Cells::Workbook.new('create_workbook_from_template.xlsx')
55
+ response = workbook.create_workbook_from_template(template_file_name='test_cells.xlsx')
56
+ assert_instance_of(Hash, response)
57
+ end
58
+
59
+ def test_get_name_count
60
+ workbook = Aspose::Cloud::Cells::Workbook.new('test_cells.xlsx')
61
+ response = workbook.get_name_count()
62
+ assert_equal true, response>0
63
+ end
64
+
65
+ def test_get_worksheets_count
66
+ workbook = Aspose::Cloud::Cells::Workbook.new('test_cells.xlsx')
67
+ response = workbook.get_worksheets_count()
68
+ assert_equal true, response>0
69
+ end
70
+
71
+ def test_get_default_style
72
+ workbook = Aspose::Cloud::Cells::Workbook.new('test_cells.xlsx')
73
+ response = workbook.get_default_style()
74
+ assert_instance_of(Hash,response)
75
+ end
76
+
77
+ def test_encrypt_workbook
78
+ workbook = Aspose::Cloud::Cells::Workbook.new('test_cells.xlsx')
79
+ response = workbook.encrypt_workbook(encryption_type='XOR', password='123456', key_length=128)
80
+ assert_equal true, response
81
+ end
82
+
83
+ def test_decrypt_workbook
84
+ workbook = Aspose::Cloud::Cells::Workbook.new('test_cells.xlsx')
85
+ response = workbook.decrypt_workbook(password='123456')
86
+ assert_equal true, response
87
+ end
88
+
89
+ def test_protect_workbook
90
+ workbook = Aspose::Cloud::Cells::Workbook.new('test_cells.xlsx')
91
+ response = workbook.protect_workbook(protection_type='all', password='123456')
92
+ assert_equal true, response
93
+ end
94
+
95
+ def test_unprotect_workbook
96
+ workbook = Aspose::Cloud::Cells::Workbook.new('test_cells.xlsx')
97
+ response = workbook.unprotect_workbook(password='123456')
98
+ assert_equal true, response
99
+ end
100
+
101
+ def test_set_modify_password
102
+ workbook = Aspose::Cloud::Cells::Workbook.new('test_cells.xlsx')
103
+ response = workbook.set_modify_password(password='123456')
104
+ assert_equal true, response
105
+ end
106
+
107
+ def test_clear_modify_password
108
+ workbook = Aspose::Cloud::Cells::Workbook.new('test_cells.xlsx')
109
+ response = workbook.clear_modify_password(password='123456')
110
+ assert_equal true, response
111
+ end
112
+
113
+ def test_decrypt_password
114
+ workbook = Aspose::Cloud::Cells::Workbook.new('test_cells.xlsx')
115
+ response = workbook.decrypt_password(password='123456')
116
+ assert_equal true, response
117
+ end
118
+
119
+ def test_add_worksheet
120
+ workbook = Aspose::Cloud::Cells::Workbook.new('test_cells.xlsx')
121
+ response = workbook.add_worksheet(worksheet_name='My Worksheet')
122
+ assert_equal true, response
123
+ end
124
+
125
+ def test_remove_worksheet
126
+ workbook = Aspose::Cloud::Cells::Workbook.new('test_cells.xlsx')
127
+ response = workbook.remove_worksheet(worksheet_name='My Worksheet')
128
+ assert_equal true, response
129
+ end
130
+
131
+ def test_merge_workbook
132
+ workbook = Aspose::Cloud::Cells::Workbook.new('test_cells.xlsx')
133
+ response = workbook.merge_workbook(merge_filename='Test.xlsx')
134
+ assert_equal true, response
135
+ end
136
+
137
+ def test_split_workbook
138
+ workbook = Aspose::Cloud::Cells::Workbook.new('test_cells.xlsx')
139
+ assert_nothing_thrown 'Error' do
140
+ response = workbook.split_workbook(save_format='tiff')
141
+ end
142
+ assert_equal true, File.exist?('../Output/test_cells_1.tiff')
143
+ assert_equal true, File.exist?('../Output/test_cells_2.tiff')
144
+ end
145
+
146
+ def test_save_as
147
+ workbook = Aspose::Cloud::Cells::Workbook.new('test_cells.xlsx')
148
+ assert_nothing_thrown 'Error' do
149
+ str_xml = '<PdfSaveOptions>
150
+ <desiredPPI>300</desiredPPI>
151
+ <jpegQuality>70</jpegQuality>
152
+ <OnePagePerSheet>true</OnePagePerSheet>
153
+ <SaveFormat>Pdf</SaveFormat>
154
+ </PdfSaveOptions>'
155
+ response = workbook.save_as(str_xml, output_filename='saveas.pdf')
156
+ end
157
+ assert_equal true, File.exist?('../Output/saveas.pdf')
158
+ end
159
+
160
+ def test_autofit_rows
161
+ workbook = Aspose::Cloud::Cells::Workbook.new('test_cells.xlsx')
162
+ assert_nothing_thrown 'Error' do
163
+ response = workbook.autofit_rows(save_format='pdf')
164
+ end
165
+ assert_equal true, File.exist?('../Output/test_cells.pdf')
166
+ end
167
+ end
@@ -0,0 +1,435 @@
1
+
2
+ require 'test/unit'
3
+ require_relative '../../lib/asposecloud'
4
+
5
+ class WorksheetTests < Test::Unit::TestCase
6
+
7
+ def setup
8
+ file = File.read('../setup.json')
9
+ data = JSON.parse(file)
10
+
11
+ Aspose::Cloud::Common::AsposeApp.app_key = data['app_key']
12
+ Aspose::Cloud::Common::AsposeApp.app_sid = data['app_sid']
13
+ Aspose::Cloud::Common::AsposeApp.output_location = data['output_location']
14
+ Aspose::Cloud::Common::Product.set_base_product_uri(data['product_uri'])
15
+ end
16
+
17
+ def test_get_cells_list
18
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet1')
19
+ response = worksheet.get_cells_list(offset=0, count=10)
20
+ assert_instance_of(Array, response)
21
+ end
22
+
23
+ def test_get_row_list
24
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet1')
25
+ response = worksheet.get_row_list(offset=0, count=10)
26
+ assert_instance_of(Array, response)
27
+ end
28
+
29
+ def test_get_columns_list
30
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet1')
31
+ response = worksheet.get_columns_list(offset=0, count=10)
32
+ assert_instance_of(Array, response)
33
+ end
34
+
35
+ def test_get_max_columns
36
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet3')
37
+ response = worksheet.get_max_columns(offset=0, count=10)
38
+ assert_equal true, response>=0
39
+ end
40
+
41
+ def test_get_max_row
42
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet3')
43
+ response = worksheet.get_max_row(offset=0, count=10)
44
+ assert_equal true, response>=0
45
+ end
46
+
47
+ def test_get_first_cell
48
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet1')
49
+ response = worksheet.get_first_cell(offset=0, count=10)
50
+ assert_instance_of(Hash, response)
51
+ end
52
+
53
+ def test_get_last_cell
54
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet1')
55
+ response = worksheet.get_last_cell(offset=0, count=10)
56
+ assert_instance_of(Hash, response)
57
+ end
58
+
59
+ def test_get_max_data_row
60
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet1')
61
+ response = worksheet.get_max_data_row(offset=0, count=10)
62
+ assert_equal true, response>=0.to_s
63
+ end
64
+
65
+ def test_get_max_data_column
66
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet3')
67
+ response = worksheet.get_max_data_column(offset=0, count=10)
68
+ assert_equal true, response>=0.to_s
69
+ end
70
+
71
+ def test_get_min_row
72
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('Test.xlsx', 'Sheet1')
73
+ response = worksheet.get_min_row(offset=0, count=10)
74
+ assert_equal true, response>=0.to_s
75
+ end
76
+
77
+ def test_get_min_data_row
78
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('Test.xlsx', 'Sheet1')
79
+ response = worksheet.get_min_data_row(offset=0, count=100)
80
+ assert_equal true, response>=0.to_s
81
+ end
82
+
83
+ def test_get_min_column
84
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('Test.xlsx', 'Sheet1')
85
+ response = worksheet.get_min_column(offset=0, count=10)
86
+ assert_equal true, response>=0.to_s
87
+ end
88
+
89
+ def test_get_min_data_column
90
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet1')
91
+ response = worksheet.get_min_data_column(offset=0, count=10)
92
+ assert_equal true, response>=0.to_s
93
+ end
94
+
95
+ def test_get_cells_count
96
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet1')
97
+ response = worksheet.get_cells_count(offset=0, count=10)
98
+ assert_equal true, response>=0
99
+ end
100
+
101
+ def test_get_cell
102
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet1')
103
+ response = worksheet.get_cell(cell_name='A3')
104
+ assert_instance_of(Hash, response)
105
+ end
106
+
107
+ def test_get_cell_style
108
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet1')
109
+ response = worksheet.get_cell_style(cell_name='A3')
110
+ assert_instance_of(Hash, response)
111
+ end
112
+
113
+ def test_set_cell_style
114
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet1')
115
+ style='style data here'
116
+ response = worksheet.set_cell_style(cell_name='A3', style)
117
+ assert_equal true, response
118
+ end
119
+
120
+ def test_get_chart_by_index
121
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet2')
122
+ response = worksheet.get_chart_by_index(chart_index=0)
123
+ assert_instance_of(Hash, response)
124
+ end
125
+
126
+ def test_get_hyperlink_by_index
127
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('Test.xlsx', 'Sheet1')
128
+ response = worksheet.get_hyperlink_by_index(link_index=0)
129
+ assert_instance_of(Hash, response)
130
+ end
131
+
132
+ def test_add_hyperlink
133
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet1')
134
+ response = worksheet.add_hyperlink(first_row=1, first_column=1, total_rows=1, total_colunms=1, url='www.google.com')
135
+ assert_equal true, File.exist?('../Output/test_cells.xlsx')
136
+ end
137
+
138
+ def test_update_hyperlink
139
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet1')
140
+ response = worksheet.update_hyperlink(hyperlink_index=0, url='www.banckle.com', screen_tip='Welcome', display_text='Banckle')
141
+ assert_equal true, File.exist?('../Output/test_cells.xlsx')
142
+ end
143
+
144
+ def test_delete_hyperlink
145
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet1')
146
+ response = worksheet.delete_hyperlink(hyperlink_index=0)
147
+ assert_equal true, File.exist?('../Output/test_cells.xlsx')
148
+ end
149
+
150
+ def test_get_comment
151
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet1')
152
+ response = worksheet.get_comment(cell_name='A2')
153
+ assert_instance_of(Hash, response)
154
+ end
155
+
156
+ def test_get_oleobject_by_index
157
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet2')
158
+ response = worksheet.get_oleobject_by_index(ole_index=0)
159
+ assert_instance_of(Hash, response)
160
+ end
161
+
162
+ def test_add_oleobject
163
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet2')
164
+ response = worksheet.add_oleobject(ole_file='ole.docx', image_file='ole.png', upper_left_row=20, upper_left_column=20, height=200, width=200)
165
+ assert_equal true, response
166
+ end
167
+
168
+ def test_update_oleobject
169
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet2')
170
+ response = worksheet.update_oleobject(index=1, str_xml)
171
+ assert_equal true, response
172
+ end
173
+
174
+ def test_delete_oleobject
175
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet2')
176
+ response = worksheet.delete_oleobject(index=1)
177
+ assert_equal true, response
178
+ end
179
+
180
+ def test_delete_all_oleobjects
181
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet2')
182
+ response = worksheet.delete_all_oleobjects(index=1)
183
+ assert_equal true, response
184
+ end
185
+
186
+ def test_get_picture_by_index
187
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet2')
188
+ response = worksheet.get_picture_by_index(image_index=0)
189
+ assert_instance_of(Hash, response)
190
+ end
191
+
192
+ def test_get_validation_by_index
193
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet1')
194
+ response = worksheet.get_validation_by_index(index=0)
195
+ assert_instance_of(Hash, response)
196
+ end
197
+
198
+ def test_get_validations_count
199
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet1')
200
+ response = worksheet.get_validations_count()
201
+ assert_equal true, response>=0
202
+ end
203
+
204
+ def test_get_mergedcell_by_index
205
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet1')
206
+ response = worksheet.get_mergedcell_by_index(index=0)
207
+ assert_instance_of(Hash, response)
208
+ end
209
+
210
+ def test_get_mergedcells_count
211
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet1')
212
+ response = worksheet.get_mergedcells_count()
213
+ assert_equal true, response>=0
214
+ end
215
+
216
+ def test_get_pictures_count
217
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet2')
218
+ response = worksheet.get_pictures_count()
219
+ assert_equal true, response>=0
220
+ end
221
+
222
+ def test_get_oleobjects_count
223
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet2')
224
+ response = worksheet.get_oleobjects_count()
225
+ assert_equal true, response>=0
226
+ end
227
+
228
+ def test_get_charts_count
229
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet2')
230
+ response = worksheet.get_charts_count()
231
+ assert_equal true, response>=0
232
+ end
233
+
234
+ def test_get_comments_count
235
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet1')
236
+ response = worksheet.get_comments_count()
237
+ assert_equal true, response>=0
238
+ end
239
+
240
+ def test_get_hyperlinks_count
241
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet1')
242
+ response = worksheet.get_hyperlinks_count()
243
+ assert_equal true, response>=0
244
+ end
245
+
246
+ def test_hide_worksheet
247
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet1')
248
+ response = worksheet.hide_worksheet()
249
+ assert_equal true, response
250
+ end
251
+
252
+ def test_unhide_worksheet
253
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet1')
254
+ response = worksheet.unhide_worksheet()
255
+ assert_equal true, response
256
+ end
257
+
258
+ def test_get_rows_count
259
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet1')
260
+ response = worksheet.get_rows_count(offset=1, count=1)
261
+ assert_equal true, response>=0
262
+ end
263
+
264
+ def test_get_row
265
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet1')
266
+ response = worksheet.get_row(index=1)
267
+ assert_instance_of(Hash, response)
268
+ end
269
+
270
+ def test_delete_row
271
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet1')
272
+ response = worksheet.delete_row(index=1)
273
+ assert_equal true, response
274
+ end
275
+
276
+ def test_get_column
277
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet1')
278
+ response = worksheet.get_column(index=1)
279
+ assert_instance_of(Hash, response)
280
+ end
281
+
282
+ def test_move_worksheet
283
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet1')
284
+ response = worksheet.move_worksheet(position=2)
285
+ assert_equal true, response
286
+ end
287
+
288
+ def test_calculate_formula
289
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet3')
290
+ response = worksheet.calculate_formula(formula='SUM(A3:A4)')
291
+ assert_instance_of(Hash, response)
292
+ end
293
+
294
+ def test_set_cell_value
295
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet1')
296
+ response = worksheet.set_cell_value(cell_name='A1', value_type='string', value='123')
297
+ assert_equal true, response
298
+ end
299
+
300
+ def test_add_picture
301
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet3')
302
+ response = worksheet.add_picture(picture_path='watermark.png', upper_left_row=12, upper_left_column=12, lower_right_row=20, lower_right_column=20)
303
+ assert_equal true, response
304
+ end
305
+
306
+ def test_update_picture
307
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet2')
308
+ picture_index = 0
309
+ picture_data = 'picture data is in xml format'
310
+ response = worksheet.update_picture(picture_index, picture_data)
311
+ assert_equal true, response
312
+ end
313
+
314
+ def test_delete_pictures
315
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet2')
316
+ response = worksheet.delete_pictures()
317
+ assert_equal true, File.exist?('../Output/test_cells.xlsx')
318
+ end
319
+
320
+ def test_delete_picture
321
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet2')
322
+ response = worksheet.delete_picture(picture_index=0)
323
+ assert_equal true, File.exist?('../Output/test_cells.xlsx')
324
+ end
325
+
326
+ def test_copy_worksheet
327
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet3')
328
+ response = worksheet.copy_worksheet(new_worksheet_name='New Sheet')
329
+ assert_equal true, File.exist?('../Output/test_cells.xlsx')
330
+ end
331
+
332
+ def test_rename_worksheet
333
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet1')
334
+ response = worksheet.rename_worksheet(new_worksheet_name='Rename Sheet')
335
+ assert_equal true, File.exist?('../Output/test_cells.xlsx')
336
+ end
337
+
338
+ def test_set_background
339
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet1')
340
+ response = worksheet.set_background(background_image='watermark.png')
341
+ assert_equal true, File.exist?('../Output/test_cells.xlsx')
342
+ end
343
+
344
+ def test_delete_background
345
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet3')
346
+ response = worksheet.delete_background()
347
+ assert_equal true, File.exist?('../Output/test_cells.xlsx')
348
+ end
349
+
350
+ def test_freeze_panes
351
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet1')
352
+ response = worksheet.freeze_panes(row=1, column=1, freezed_rows=1, freezed_columns=1)
353
+ assert_equal true, File.exist?('../Output/test_cells.xlsx')
354
+ end
355
+
356
+ def test_unfreeze_panes
357
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet1')
358
+ response = worksheet.unfreeze_panes(row=1, column=1, freezed_rows=1, freezed_columns=1)
359
+ assert_equal true, File.exist?('../Output/test_cells.xlsx')
360
+ end
361
+
362
+ def test_add_empty_row
363
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet1')
364
+ response = worksheet.add_empty_row(row_id=0)
365
+ assert_equal true, File.exist?('../Output/test_cells.xlsx')
366
+ end
367
+
368
+ def test_copy_row
369
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet1')
370
+ response = worksheet.copy_row(source_row_index=2, destination_row_index=1, row_number=1)
371
+ assert_equal true, File.exist?('../Output/test_cells.xlsx')
372
+ end
373
+
374
+ def test_hide_rows
375
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet3')
376
+ response = worksheet.hide_rows(start_row=2, total_rows=2)
377
+ assert_equal true, File.exist?('../Output/test_cells.xlsx')
378
+ end
379
+
380
+ def test_unhide_rows
381
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet3')
382
+ response = worksheet.unhide_rows(start_row=2, total_rows=2)
383
+ assert_equal true, File.exist?('../Output/test_cells.xlsx')
384
+ end
385
+
386
+ def test_group_rows
387
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet1')
388
+ response = worksheet.group_rows(first_index=1, last_index=5)
389
+ assert_equal true, File.exist?('../Output/test_cells.xlsx')
390
+ end
391
+
392
+ def test_ungroup_rows
393
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet1')
394
+ response = worksheet.ungroup_rows(first_index=1, last_index=5)
395
+ assert_equal true, File.exist?('../Output/test_cells.xlsx')
396
+ end
397
+
398
+ def test_merge_cells
399
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet1')
400
+ response = worksheet.merge_cells(start_row=1, start_column=1, total_rows=2, total_colunms=2)
401
+ assert_equal true, File.exist?('../Output/test_cells.xlsx')
402
+ end
403
+
404
+ def test_unmerge_cells
405
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet1')
406
+ response = worksheet.unmerge_cells(start_row=1, start_column=1, total_rows=2, total_colunms=2)
407
+ assert_equal true, File.exist?('../Output/test_cells.xlsx')
408
+ end
409
+
410
+ def test_clear_cells_formatting
411
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet1')
412
+ response = worksheet.clear_cells_formatting(start_row=1, start_column=1, end_row=1, end_column=1)
413
+ assert_equal true, File.exist?('../Output/test_cells.xlsx')
414
+ end
415
+
416
+ def test_clear_cells_contents
417
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet1')
418
+ response = worksheet.clear_cells_contents(range='A1:C4')
419
+ assert_equal true, File.exist?('../Output/test_cells.xlsx')
420
+ end
421
+
422
+ def test_set_range_value
423
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet1')
424
+ response = worksheet.set_range_value(cellarea='A10:B20', value='Sample', type='string')
425
+ assert_equal true, File.exist?('../Output/test_cells.xlsx')
426
+ end
427
+
428
+ def test_update_properties
429
+ worksheet = Aspose::Cloud::Cells::Worksheet.new('test_cells.xlsx', 'Sheet1')
430
+ assert_nothing_thrown 'Error' do
431
+ worksheet.update_properties(worksheet_name='New Sheet Name', gridlines_visible = false, pagebreak_preview = false, ruler_visible = false)
432
+ end
433
+ assert_equal true, File.exist?('../Output/test_cells.tiff')
434
+ end
435
+ end