asposecloudsdk 0.0.1
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.
- data/.gitignore +17 -0
- data/.project +18 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +4 -0
- data/Rakefile +1 -0
- data/asposecloudsdk.gemspec +24 -0
- data/lib/Barcode/builder.rb +31 -0
- data/lib/Barcode/reader.rb +87 -0
- data/lib/Cells/chart_editor.rb +145 -0
- data/lib/Cells/convertor.rb +225 -0
- data/lib/Cells/extractor.rb +155 -0
- data/lib/Cells/text_editor.rb +99 -0
- data/lib/Cells/workbook.rb +437 -0
- data/lib/Cells/worksheet.rb +819 -0
- data/lib/Common/aspose_app.rb +14 -0
- data/lib/Common/product.rb +17 -0
- data/lib/Common/utils.rb +108 -0
- data/lib/Ocr/extractor.rb +128 -0
- data/lib/Pdf/annotation_editor.rb +533 -0
- data/lib/Pdf/converter.rb +201 -0
- data/lib/Pdf/document.rb +643 -0
- data/lib/Pdf/extractor.rb +139 -0
- data/lib/Pdf/text_editor.rb +231 -0
- data/lib/Slides/converter.rb +105 -0
- data/lib/Slides/document.rb +489 -0
- data/lib/Slides/extractor.rb +208 -0
- data/lib/Storage/folder.rb +227 -0
- data/lib/Words/builder.rb +159 -0
- data/lib/Words/converter.rb +79 -0
- data/lib/Words/document.rb +295 -0
- data/lib/Words/extractor.rb +318 -0
- data/lib/Words/mail_merge.rb +143 -0
- data/lib/aspose_barcode.rb +4 -0
- data/lib/aspose_cells.rb +7 -0
- data/lib/aspose_common.rb +12 -0
- data/lib/aspose_ocr.rb +4 -0
- data/lib/aspose_pdf.rb +6 -0
- data/lib/aspose_slides.rb +4 -0
- data/lib/aspose_storage.rb +2 -0
- data/lib/aspose_words.rb +6 -0
- data/lib/asposecloudsdk.rb +10 -0
- data/lib/asposecloudsdk/version.rb +3 -0
- metadata +145 -0
@@ -0,0 +1,819 @@
|
|
1
|
+
module Aspose
|
2
|
+
module Cloud
|
3
|
+
|
4
|
+
module Cells
|
5
|
+
class Worksheet
|
6
|
+
def initialize(filename,worksheet_name)
|
7
|
+
@filename = filename
|
8
|
+
@worksheet_name = worksheet_name
|
9
|
+
end
|
10
|
+
|
11
|
+
def get_cells_list(offset,count)
|
12
|
+
begin
|
13
|
+
if(@filename == '')
|
14
|
+
raise 'Base File Name is not specified'
|
15
|
+
end
|
16
|
+
if(@worksheet_name == '')
|
17
|
+
raise 'Worksheet Name is not specified'
|
18
|
+
end
|
19
|
+
str_uri = $product_uri + '/cells/' + @filename + '/worksheets/' + @worksheet_name
|
20
|
+
str_uri += '/cells?offset=' + offset.to_s + '&count=' + count.to_s
|
21
|
+
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
22
|
+
response = RestClient.get(signed_uri, :accept => 'application/json' )
|
23
|
+
json = JSON.parse(response)
|
24
|
+
return json['Cells']['CellList']
|
25
|
+
|
26
|
+
rescue Exception=>e
|
27
|
+
print e
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def get_row_list(offset,count)
|
32
|
+
begin
|
33
|
+
if(@filename == '')
|
34
|
+
raise 'Base File Name is not specified'
|
35
|
+
end
|
36
|
+
if(@worksheet_name == '')
|
37
|
+
raise 'Worksheet Name is not specified'
|
38
|
+
end
|
39
|
+
str_uri = $product_uri + '/cells/' + @filename + '/worksheets/' + @worksheet_name
|
40
|
+
str_uri += '/cells/rows?offset=' + offset.to_s + '&count=' + count.to_s
|
41
|
+
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
42
|
+
response = RestClient.get(signed_uri, :accept => 'application/json' )
|
43
|
+
json = JSON.parse(response)
|
44
|
+
return json['Rows']['RowsList']
|
45
|
+
|
46
|
+
rescue Exception=>e
|
47
|
+
print e
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def get_columns_list(offset,count)
|
52
|
+
begin
|
53
|
+
if(@filename == '')
|
54
|
+
raise 'Base File Name is not specified'
|
55
|
+
end
|
56
|
+
if(@worksheet_name == '')
|
57
|
+
raise 'Worksheet Name is not specified'
|
58
|
+
end
|
59
|
+
str_uri = $product_uri + '/cells/' + @filename + '/worksheets/' + @worksheet_name
|
60
|
+
str_uri += '/cells/columns?offset=' + offset.to_s + '&count=' + count.to_s
|
61
|
+
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
62
|
+
response = RestClient.get(signed_uri, :accept => 'application/json' )
|
63
|
+
json = JSON.parse(response)
|
64
|
+
return json['Columns']['ColumnsList']
|
65
|
+
|
66
|
+
rescue Exception=>e
|
67
|
+
print e
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def get_max_columns(offset,count)
|
72
|
+
begin
|
73
|
+
if(@filename == '')
|
74
|
+
raise 'Base File Name is not specified'
|
75
|
+
end
|
76
|
+
if(@worksheet_name == '')
|
77
|
+
raise 'Worksheet Name is not specified'
|
78
|
+
end
|
79
|
+
str_uri = $product_uri + '/cells/' + @filename + '/worksheets/' + @worksheet_name
|
80
|
+
str_uri += '/cells?offset=' + offset.to_s + '&count=' + count.to_s
|
81
|
+
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
82
|
+
response = RestClient.get(signed_uri, :accept => 'application/json' )
|
83
|
+
json = JSON.parse(response)
|
84
|
+
return json['Cells']['MaxColumn']
|
85
|
+
|
86
|
+
rescue Exception=>e
|
87
|
+
print e
|
88
|
+
return 0
|
89
|
+
end
|
90
|
+
end
|
91
|
+
def get_max_row(offset,count)
|
92
|
+
begin
|
93
|
+
if(@filename == '')
|
94
|
+
raise 'Base File Name is not specified'
|
95
|
+
end
|
96
|
+
if(@worksheet_name == '')
|
97
|
+
raise 'Worksheet Name is not specified'
|
98
|
+
end
|
99
|
+
str_uri = $product_uri + '/cells/' + @filename + '/worksheets/' + @worksheet_name
|
100
|
+
str_uri += '/cells?offset=' + offset.to_s + '&count=' + count.to_s
|
101
|
+
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
102
|
+
response = RestClient.get(signed_uri, :accept => 'application/json' )
|
103
|
+
json = JSON.parse(response)
|
104
|
+
return json['Cells']['MaxRow']
|
105
|
+
|
106
|
+
rescue Exception=>e
|
107
|
+
print e
|
108
|
+
return 0
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
def get_cells_count(offset,count)
|
113
|
+
begin
|
114
|
+
if(@filename == '')
|
115
|
+
raise 'Base File Name is not specified'
|
116
|
+
end
|
117
|
+
if(@worksheet_name == '')
|
118
|
+
raise 'Worksheet Name is not specified'
|
119
|
+
end
|
120
|
+
str_uri = $product_uri + '/cells/' + @filename + '/worksheets/' + @worksheet_name
|
121
|
+
str_uri += '/cells?offset=' + offset.to_s + '&count=' + count.to_s
|
122
|
+
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
123
|
+
response = RestClient.get(signed_uri, :accept => 'application/json' )
|
124
|
+
json = JSON.parse(response)
|
125
|
+
return json['Cells']['CellCount']
|
126
|
+
|
127
|
+
rescue Exception=>e
|
128
|
+
print e
|
129
|
+
return 0
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
def get_auto_shapes_count
|
134
|
+
begin
|
135
|
+
if(@filename == '')
|
136
|
+
raise 'Base File Name is not specified'
|
137
|
+
end
|
138
|
+
if(@worksheet_name == '')
|
139
|
+
raise 'Worksheet Name is not specified'
|
140
|
+
end
|
141
|
+
str_uri = $product_uri + '/cells/' + @filename + '/worksheets/' + @worksheet_name + '/autoshapes'
|
142
|
+
|
143
|
+
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
144
|
+
response = RestClient.get(signed_uri, :accept => 'application/json' )
|
145
|
+
json = JSON.parse(response)
|
146
|
+
return json['AutoShapes']['AuotShapeList'].count
|
147
|
+
|
148
|
+
rescue Exception=>e
|
149
|
+
print e
|
150
|
+
return -1
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
def get_auto_shapes_by_index(index)
|
155
|
+
begin
|
156
|
+
if(@filename == '')
|
157
|
+
raise 'Base File Name is not specified'
|
158
|
+
end
|
159
|
+
if(@worksheet_name == '')
|
160
|
+
raise 'Worksheet Name is not specified'
|
161
|
+
end
|
162
|
+
str_uri = $product_uri + '/cells/' + @filename + '/worksheets/' + @worksheet_name + '/autoshapes/' + index.to_s
|
163
|
+
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
164
|
+
response = RestClient.get(signed_uri, :accept => 'application/json' )
|
165
|
+
json = JSON.parse(response)
|
166
|
+
return json['AutoShapes']
|
167
|
+
|
168
|
+
rescue Exception=>e
|
169
|
+
print e
|
170
|
+
return nil
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
def get_cell(cell_name)
|
175
|
+
begin
|
176
|
+
if(@filename == '')
|
177
|
+
raise 'Base File Name is not specified'
|
178
|
+
end
|
179
|
+
if(@worksheet_name == '')
|
180
|
+
raise 'Worksheet Name is not specified'
|
181
|
+
end
|
182
|
+
str_uri = $product_uri + '/cells/' + @filename + '/worksheets/' + @worksheet_name + '/cells/' + cell_name
|
183
|
+
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
184
|
+
response = RestClient.get(signed_uri, :accept => 'application/json' )
|
185
|
+
json = JSON.parse(response)
|
186
|
+
return json['Cell']
|
187
|
+
|
188
|
+
rescue Exception=>e
|
189
|
+
print e
|
190
|
+
return nil
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
def get_cell_style(cell_name='')
|
195
|
+
begin
|
196
|
+
if(@filename == '')
|
197
|
+
raise 'Base File Name is not specified'
|
198
|
+
end
|
199
|
+
if(@worksheet_name == '')
|
200
|
+
raise 'Worksheet Name is not specified'
|
201
|
+
end
|
202
|
+
str_uri = $product_uri + '/cells/' + @filename + '/worksheets/' + @worksheet_name + '/cells/' + cell_name + '/style'
|
203
|
+
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
204
|
+
response = RestClient.get(signed_uri, :accept => 'application/json' )
|
205
|
+
json = JSON.parse(response)
|
206
|
+
return json['Style']
|
207
|
+
|
208
|
+
rescue Exception=>e
|
209
|
+
print e
|
210
|
+
return nil
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
214
|
+
def set_cell_style(cell_name='',style)
|
215
|
+
begin
|
216
|
+
if(@filename == '')
|
217
|
+
raise 'Base File Name is not specified'
|
218
|
+
end
|
219
|
+
if(@worksheet_name == '')
|
220
|
+
raise 'Worksheet Name is not specified'
|
221
|
+
end
|
222
|
+
json_data = style.to_json
|
223
|
+
str_uri = $product_uri + '/cells/' + @filename + '/worksheets/' + @worksheet_name + '/cells/' + cell_name + '/style'
|
224
|
+
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
225
|
+
response = RestClient.post(signed_uri,json_data, :accept => 'application/json' )
|
226
|
+
json = JSON.parse(response)
|
227
|
+
if(json['Code'] == 200)
|
228
|
+
return true
|
229
|
+
else
|
230
|
+
return false
|
231
|
+
end
|
232
|
+
|
233
|
+
rescue Exception=>e
|
234
|
+
print e
|
235
|
+
return false
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
239
|
+
def get_chart_by_index(index)
|
240
|
+
begin
|
241
|
+
if(@filename == '')
|
242
|
+
raise 'Base File Name is not specified'
|
243
|
+
end
|
244
|
+
if(@worksheet_name == '')
|
245
|
+
raise 'Worksheet Name is not specified'
|
246
|
+
end
|
247
|
+
str_uri = $product_uri + '/cells/' + @filename + '/worksheets/' + @worksheet_name + '/charts/' + index.to_s
|
248
|
+
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
249
|
+
response = RestClient.get(signed_uri, :accept => 'application/json' )
|
250
|
+
json = JSON.parse(response)
|
251
|
+
return json['Chart']
|
252
|
+
|
253
|
+
rescue Exception=>e
|
254
|
+
print e
|
255
|
+
return nil
|
256
|
+
end
|
257
|
+
end
|
258
|
+
|
259
|
+
def get_hyperlink_by_index(index)
|
260
|
+
begin
|
261
|
+
if(@filename == '')
|
262
|
+
raise 'Base File Name is not specified'
|
263
|
+
end
|
264
|
+
if(@worksheet_name == '')
|
265
|
+
raise 'Worksheet Name is not specified'
|
266
|
+
end
|
267
|
+
str_uri = $product_uri + '/cells/' + @filename + '/worksheets/' + @worksheet_name + '/hyperlinks/' + index.to_s
|
268
|
+
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
269
|
+
response = RestClient.get(signed_uri, :accept => 'application/json' )
|
270
|
+
json = JSON.parse(response)
|
271
|
+
return json['Hyperlink']
|
272
|
+
|
273
|
+
rescue Exception=>e
|
274
|
+
print e
|
275
|
+
return nil
|
276
|
+
end
|
277
|
+
end
|
278
|
+
|
279
|
+
def get_comment(cell_name='')
|
280
|
+
begin
|
281
|
+
if(@filename == '')
|
282
|
+
raise 'Base File Name is not specified'
|
283
|
+
end
|
284
|
+
if(@worksheet_name == '')
|
285
|
+
raise 'Worksheet Name is not specified'
|
286
|
+
end
|
287
|
+
str_uri = $product_uri + '/cells/' + @filename + '/worksheets/' + @worksheet_name + '/comments/' + cell_name.to_s
|
288
|
+
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
289
|
+
response = RestClient.get(signed_uri, :accept => 'application/json' )
|
290
|
+
json = JSON.parse(response)
|
291
|
+
return json['Comment']
|
292
|
+
|
293
|
+
rescue Exception=>e
|
294
|
+
print e
|
295
|
+
return nil
|
296
|
+
end
|
297
|
+
end
|
298
|
+
|
299
|
+
def get_oleobject_by_index(index)
|
300
|
+
begin
|
301
|
+
if(@filename == '')
|
302
|
+
raise 'Base File Name is not specified'
|
303
|
+
end
|
304
|
+
if(@worksheet_name == '')
|
305
|
+
raise 'Worksheet Name is not specified'
|
306
|
+
end
|
307
|
+
str_uri = $product_uri + '/cells/' + @filename + '/worksheets/' + @worksheet_name + '/oleobjects/' + index.to_s
|
308
|
+
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
309
|
+
response = RestClient.get(signed_uri, :accept => 'application/json' )
|
310
|
+
json = JSON.parse(response)
|
311
|
+
return json['OleObject']
|
312
|
+
|
313
|
+
rescue Exception=>e
|
314
|
+
print e
|
315
|
+
return nil
|
316
|
+
end
|
317
|
+
end
|
318
|
+
def get_picture_by_index(index)
|
319
|
+
begin
|
320
|
+
if(@filename == '')
|
321
|
+
raise 'Base File Name is not specified'
|
322
|
+
end
|
323
|
+
if(@worksheet_name == '')
|
324
|
+
raise 'Worksheet Name is not specified'
|
325
|
+
end
|
326
|
+
str_uri = $product_uri + '/cells/' + @filename + '/worksheets/' + @worksheet_name + '/pictures/' + index.to_s
|
327
|
+
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
328
|
+
response = RestClient.get(signed_uri, :accept => 'application/json' )
|
329
|
+
json = JSON.parse(response)
|
330
|
+
return json['Picture']
|
331
|
+
|
332
|
+
rescue Exception=>e
|
333
|
+
print e
|
334
|
+
return nil
|
335
|
+
end
|
336
|
+
end
|
337
|
+
|
338
|
+
def get_validation_by_index(index)
|
339
|
+
begin
|
340
|
+
if(@filename == '')
|
341
|
+
raise 'Base File Name is not specified'
|
342
|
+
end
|
343
|
+
if(@worksheet_name == '')
|
344
|
+
raise 'Worksheet Name is not specified'
|
345
|
+
end
|
346
|
+
str_uri = $product_uri + '/cells/' + @filename + '/worksheets/' + @worksheet_name + '/validations/' + index.to_s
|
347
|
+
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
348
|
+
response = RestClient.get(signed_uri, :accept => 'application/json' )
|
349
|
+
json = JSON.parse(response)
|
350
|
+
return json['Validation']
|
351
|
+
|
352
|
+
rescue Exception=>e
|
353
|
+
print e
|
354
|
+
return nil
|
355
|
+
end
|
356
|
+
end
|
357
|
+
|
358
|
+
def get_mergedcell_by_index(index)
|
359
|
+
begin
|
360
|
+
if(@filename == '')
|
361
|
+
raise 'Base File Name is not specified'
|
362
|
+
end
|
363
|
+
if(@worksheet_name == '')
|
364
|
+
raise 'Worksheet Name is not specified'
|
365
|
+
end
|
366
|
+
str_uri = $product_uri + '/cells/' + @filename + '/worksheets/' + @worksheet_name + '/mergedCells/' + index.to_s
|
367
|
+
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
368
|
+
response = RestClient.get(signed_uri, :accept => 'application/json' )
|
369
|
+
json = JSON.parse(response)
|
370
|
+
return json['MergedCell']
|
371
|
+
|
372
|
+
rescue Exception=>e
|
373
|
+
print e
|
374
|
+
return nil
|
375
|
+
end
|
376
|
+
end
|
377
|
+
|
378
|
+
def get_mergedcells_count
|
379
|
+
begin
|
380
|
+
if(@filename == '')
|
381
|
+
raise 'Base File Name is not specified'
|
382
|
+
end
|
383
|
+
if(@worksheet_name == '')
|
384
|
+
raise 'Worksheet Name is not specified'
|
385
|
+
end
|
386
|
+
str_uri = $product_uri + '/cells/' + @filename + '/worksheets/' + @worksheet_name + '/mergedCells'
|
387
|
+
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
388
|
+
response = RestClient.get(signed_uri, :accept => 'application/json' )
|
389
|
+
json = JSON.parse(response)
|
390
|
+
return json['MergedCells']['Count']
|
391
|
+
|
392
|
+
rescue Exception=>e
|
393
|
+
print e
|
394
|
+
return -1
|
395
|
+
end
|
396
|
+
end
|
397
|
+
|
398
|
+
def get_validations_count
|
399
|
+
begin
|
400
|
+
if(@filename == '')
|
401
|
+
raise 'Base File Name is not specified'
|
402
|
+
end
|
403
|
+
if(@worksheet_name == '')
|
404
|
+
raise 'Worksheet Name is not specified'
|
405
|
+
end
|
406
|
+
str_uri = $product_uri + '/cells/' + @filename + '/worksheets/' + @worksheet_name + '/validations'
|
407
|
+
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
408
|
+
response = RestClient.get(signed_uri, :accept => 'application/json' )
|
409
|
+
json = JSON.parse(response)
|
410
|
+
return json['Validations']['Count']
|
411
|
+
|
412
|
+
rescue Exception=>e
|
413
|
+
print e
|
414
|
+
return -1
|
415
|
+
end
|
416
|
+
end
|
417
|
+
|
418
|
+
def get_pictures_count
|
419
|
+
begin
|
420
|
+
if(@filename == '')
|
421
|
+
raise 'Base File Name is not specified'
|
422
|
+
end
|
423
|
+
if(@worksheet_name == '')
|
424
|
+
raise 'Worksheet Name is not specified'
|
425
|
+
end
|
426
|
+
str_uri = $product_uri + '/cells/' + @filename + '/worksheets/' + @worksheet_name + '/pictures'
|
427
|
+
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
428
|
+
response = RestClient.get(signed_uri, :accept => 'application/json' )
|
429
|
+
json = JSON.parse(response)
|
430
|
+
return json['Pictures']['PictureList'].count
|
431
|
+
|
432
|
+
rescue Exception=>e
|
433
|
+
print e
|
434
|
+
return -1
|
435
|
+
end
|
436
|
+
end
|
437
|
+
|
438
|
+
def get_oleobjects_count
|
439
|
+
begin
|
440
|
+
if(@filename == '')
|
441
|
+
raise 'Base File Name is not specified'
|
442
|
+
end
|
443
|
+
if(@worksheet_name == '')
|
444
|
+
raise 'Worksheet Name is not specified'
|
445
|
+
end
|
446
|
+
str_uri = $product_uri + '/cells/' + @filename + '/worksheets/' + @worksheet_name + '/oleobjects'
|
447
|
+
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
448
|
+
response = RestClient.get(signed_uri, :accept => 'application/json' )
|
449
|
+
json = JSON.parse(response)
|
450
|
+
return json['OleObjects']['OleOjectList'].count
|
451
|
+
|
452
|
+
rescue Exception=>e
|
453
|
+
print e
|
454
|
+
return -1
|
455
|
+
end
|
456
|
+
end
|
457
|
+
|
458
|
+
def get_charts_count
|
459
|
+
begin
|
460
|
+
if(@filename == '')
|
461
|
+
raise 'Base File Name is not specified'
|
462
|
+
end
|
463
|
+
if(@worksheet_name == '')
|
464
|
+
raise 'Worksheet Name is not specified'
|
465
|
+
end
|
466
|
+
str_uri = $product_uri + '/cells/' + @filename + '/worksheets/' + @worksheet_name + '/charts'
|
467
|
+
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
468
|
+
response = RestClient.get(signed_uri, :accept => 'application/json' )
|
469
|
+
json = JSON.parse(response)
|
470
|
+
return json['Charts']['ChartList'].count
|
471
|
+
|
472
|
+
rescue Exception=>e
|
473
|
+
print e
|
474
|
+
return -1
|
475
|
+
end
|
476
|
+
end
|
477
|
+
|
478
|
+
def get_comments_count
|
479
|
+
begin
|
480
|
+
if(@filename == '')
|
481
|
+
raise 'Base File Name is not specified'
|
482
|
+
end
|
483
|
+
if(@worksheet_name == '')
|
484
|
+
raise 'Worksheet Name is not specified'
|
485
|
+
end
|
486
|
+
str_uri = $product_uri + '/cells/' + @filename + '/worksheets/' + @worksheet_name + '/comments'
|
487
|
+
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
488
|
+
response = RestClient.get(signed_uri, :accept => 'application/json' )
|
489
|
+
json = JSON.parse(response)
|
490
|
+
return json['Comments']['CommentList'].count
|
491
|
+
|
492
|
+
rescue Exception=>e
|
493
|
+
print e
|
494
|
+
return -1
|
495
|
+
end
|
496
|
+
end
|
497
|
+
|
498
|
+
def get_hyperlinks_count
|
499
|
+
begin
|
500
|
+
if(@filename == '')
|
501
|
+
raise 'Base File Name is not specified'
|
502
|
+
end
|
503
|
+
if(@worksheet_name == '')
|
504
|
+
raise 'Worksheet Name is not specified'
|
505
|
+
end
|
506
|
+
str_uri = $product_uri + '/cells/' + @filename + '/worksheets/' + @worksheet_name + '/hyperlinks'
|
507
|
+
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
508
|
+
response = RestClient.get(signed_uri, :accept => 'application/json' )
|
509
|
+
json = JSON.parse(response)
|
510
|
+
return json['Hyperlinks']['HyperlinkList'].count
|
511
|
+
|
512
|
+
rescue Exception=>e
|
513
|
+
print e
|
514
|
+
return -1
|
515
|
+
end
|
516
|
+
end
|
517
|
+
|
518
|
+
def hide_worksheet
|
519
|
+
begin
|
520
|
+
if(@filename == '')
|
521
|
+
raise 'Base File Name is not specified'
|
522
|
+
end
|
523
|
+
if(@worksheet_name == '')
|
524
|
+
raise 'Worksheet Name is not specified'
|
525
|
+
end
|
526
|
+
str_uri = $product_uri + '/cells/' + @filename + '/worksheets/' + @worksheet_name + '/visible?isVisible=false'
|
527
|
+
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
528
|
+
response = RestClient.put(signed_uri, '',:accept => 'application/json' )
|
529
|
+
json = JSON.parse(response)
|
530
|
+
if(json['Code']==200)
|
531
|
+
return true
|
532
|
+
else
|
533
|
+
return false
|
534
|
+
end
|
535
|
+
|
536
|
+
rescue Exception=>e
|
537
|
+
print e
|
538
|
+
return false
|
539
|
+
end
|
540
|
+
end
|
541
|
+
|
542
|
+
def unhide_worksheet
|
543
|
+
begin
|
544
|
+
if(@filename == '')
|
545
|
+
raise 'Base File Name is not specified'
|
546
|
+
end
|
547
|
+
if(@worksheet_name == '')
|
548
|
+
raise 'Worksheet Name is not specified'
|
549
|
+
end
|
550
|
+
str_uri = $product_uri + '/cells/' + @filename + '/worksheets/' + @worksheet_name + '/visible?isVisible=true'
|
551
|
+
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
552
|
+
response = RestClient.put(signed_uri, '',:accept => 'application/json' )
|
553
|
+
json = JSON.parse(response)
|
554
|
+
if(json['Code']==200)
|
555
|
+
return true
|
556
|
+
else
|
557
|
+
return false
|
558
|
+
end
|
559
|
+
|
560
|
+
rescue Exception=>e
|
561
|
+
print e
|
562
|
+
return false
|
563
|
+
end
|
564
|
+
end
|
565
|
+
|
566
|
+
def move_worksheet(worksheet_name = '',position)
|
567
|
+
begin
|
568
|
+
if(@filename == '')
|
569
|
+
raise 'Base File Name is not specified'
|
570
|
+
end
|
571
|
+
if(@worksheet_name == '')
|
572
|
+
raise 'Worksheet Name is not specified'
|
573
|
+
end
|
574
|
+
field_array = Hash.new
|
575
|
+
field_array['DestinationWorsheet'] = worksheet_name.to_s
|
576
|
+
field_array['Position'] = position.to_s
|
577
|
+
json_data = field_array.to_json
|
578
|
+
str_uri = $product_uri + '/cells/' + @filename + '/worksheets/' + @worksheet_name + '/position'
|
579
|
+
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
580
|
+
response = RestClient.post(signed_uri, json_data,:accept => 'application/json' )
|
581
|
+
json = JSON.parse(response)
|
582
|
+
if(json['Code']==200)
|
583
|
+
return true
|
584
|
+
else
|
585
|
+
return false
|
586
|
+
end
|
587
|
+
|
588
|
+
rescue Exception=>e
|
589
|
+
print e
|
590
|
+
return false
|
591
|
+
end
|
592
|
+
end
|
593
|
+
|
594
|
+
def calculate_formula(formula = '')
|
595
|
+
begin
|
596
|
+
if(@filename == '')
|
597
|
+
raise 'Base File Name is not specified'
|
598
|
+
end
|
599
|
+
if(@worksheet_name == '')
|
600
|
+
raise 'Worksheet Name is not specified'
|
601
|
+
end
|
602
|
+
str_uri = $product_uri + '/cells/' + @filename + '/worksheets/' + @worksheet_name + '/formulaResult?formula=' + formula.to_s
|
603
|
+
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
604
|
+
response = RestClient.get(signed_uri, :accept => 'application/json' )
|
605
|
+
json = JSON.parse(response)
|
606
|
+
return json['Value']
|
607
|
+
|
608
|
+
rescue Exception=>e
|
609
|
+
print e
|
610
|
+
return nil
|
611
|
+
end
|
612
|
+
end
|
613
|
+
|
614
|
+
def set_cell_value(cell_name='',value_type='',value='')
|
615
|
+
begin
|
616
|
+
if(@filename == '')
|
617
|
+
raise 'Base File Name is not specified'
|
618
|
+
end
|
619
|
+
if(@worksheet_name == '')
|
620
|
+
raise 'Worksheet Name is not specified'
|
621
|
+
end
|
622
|
+
str_uri = $product_uri + '/cells/' + @filename + '/worksheets/' + @worksheet_name
|
623
|
+
str_uri += '/cells/' + cell_name.to_s + '?value=' + value.to_s + '&type=' + value_type.to_s
|
624
|
+
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
625
|
+
response = RestClient.post(signed_uri,'' ,:accept => 'application/json' )
|
626
|
+
json = JSON.parse(response)
|
627
|
+
if(json['Code']==200)
|
628
|
+
return true
|
629
|
+
else
|
630
|
+
return false
|
631
|
+
end
|
632
|
+
|
633
|
+
rescue Exception=>e
|
634
|
+
print e
|
635
|
+
return false
|
636
|
+
end
|
637
|
+
end
|
638
|
+
|
639
|
+
def get_rows_count(offset,count)
|
640
|
+
begin
|
641
|
+
if(@filename == '')
|
642
|
+
raise 'Base File Name is not specified'
|
643
|
+
end
|
644
|
+
if(@worksheet_name == '')
|
645
|
+
raise 'Worksheet Name is not specified'
|
646
|
+
end
|
647
|
+
str_uri = $product_uri + '/cells/' + @filename + '/worksheets/' + @worksheet_name
|
648
|
+
str_uri += '/cells/rows?offset=' + offset.to_s + '&count=' + count.to_s
|
649
|
+
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
650
|
+
response = RestClient.get(signed_uri,:accept => 'application/json' )
|
651
|
+
json = JSON.parse(response)
|
652
|
+
return json['Rows']['RowsCount']
|
653
|
+
|
654
|
+
rescue Exception=>e
|
655
|
+
print e
|
656
|
+
return -1
|
657
|
+
end
|
658
|
+
end
|
659
|
+
|
660
|
+
def get_rows(row_index)
|
661
|
+
begin
|
662
|
+
if(@filename == '')
|
663
|
+
raise 'Base File Name is not specified'
|
664
|
+
end
|
665
|
+
if(@worksheet_name == '')
|
666
|
+
raise 'Worksheet Name is not specified'
|
667
|
+
end
|
668
|
+
str_uri = $product_uri + '/cells/' + @filename + '/worksheets/' + @worksheet_name + '/cells/rows/' + row_index.to_s
|
669
|
+
|
670
|
+
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
671
|
+
response = RestClient.get(signed_uri,:accept => 'application/json' )
|
672
|
+
json = JSON.parse(response)
|
673
|
+
return json['Row']
|
674
|
+
|
675
|
+
rescue Exception=>e
|
676
|
+
print e
|
677
|
+
return nil
|
678
|
+
end
|
679
|
+
end
|
680
|
+
|
681
|
+
def delete_row(row_index)
|
682
|
+
begin
|
683
|
+
if(@filename == '')
|
684
|
+
raise 'Base File Name is not specified'
|
685
|
+
end
|
686
|
+
if(@worksheet_name == '')
|
687
|
+
raise 'Worksheet Name is not specified'
|
688
|
+
end
|
689
|
+
str_uri = $product_uri + '/cells/' + @filename + '/worksheets/' + @worksheet_name + '/cells/rows/' + row_index.to_s
|
690
|
+
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
691
|
+
response = RestClient.delete(signed_uri,:accept => 'application/json' )
|
692
|
+
json = JSON.parse(response)
|
693
|
+
if(json['Code']==200)
|
694
|
+
return true
|
695
|
+
else
|
696
|
+
return false
|
697
|
+
end
|
698
|
+
|
699
|
+
rescue Exception=>e
|
700
|
+
print e
|
701
|
+
return false
|
702
|
+
end
|
703
|
+
end
|
704
|
+
|
705
|
+
def sort_data(data_sort,cell_area = '')
|
706
|
+
begin
|
707
|
+
if(@filename == '')
|
708
|
+
raise 'Base File Name is not specified'
|
709
|
+
end
|
710
|
+
if(@worksheet_name == '')
|
711
|
+
raise 'Worksheet Name is not specified'
|
712
|
+
end
|
713
|
+
str_uri = $product_uri + '/cells/' + @filename + '/worksheets/' + @worksheet_name + '/sort?' + cell_area.to_s
|
714
|
+
json_data = data_sort.to_json
|
715
|
+
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
716
|
+
response = RestClient.post(signed_uri,json_data,:accept => 'application/json' )
|
717
|
+
json = JSON.parse(response)
|
718
|
+
if(json['Code']==200)
|
719
|
+
return true
|
720
|
+
else
|
721
|
+
return false
|
722
|
+
end
|
723
|
+
|
724
|
+
rescue Exception=>e
|
725
|
+
print e
|
726
|
+
return false
|
727
|
+
end
|
728
|
+
end
|
729
|
+
|
730
|
+
def get_column(column_index)
|
731
|
+
begin
|
732
|
+
if(@filename == '')
|
733
|
+
raise 'Base File Name is not specified'
|
734
|
+
end
|
735
|
+
if(@worksheet_name == '')
|
736
|
+
raise 'Worksheet Name is not specified'
|
737
|
+
end
|
738
|
+
str_uri = $product_uri + '/cells/' + @filename + '/worksheets/' + @worksheet_name + '/cells/columns/' + column_index.to_s
|
739
|
+
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
740
|
+
response = RestClient.get(signed_uri,:accept => 'application/json' )
|
741
|
+
json = JSON.parse(response)
|
742
|
+
return json['Column']
|
743
|
+
rescue Exception=>e
|
744
|
+
print e
|
745
|
+
return false
|
746
|
+
end
|
747
|
+
end
|
748
|
+
def get_cell(cell_name)
|
749
|
+
begin
|
750
|
+
if(@filename=='')
|
751
|
+
raise 'Base File Name is not specified'
|
752
|
+
end
|
753
|
+
if(@worksheet_name=='')
|
754
|
+
raise 'Worksheet Name is not specified'
|
755
|
+
end
|
756
|
+
str_uri = $product_uri + '/cells/' + @filename + '/worksheets/' + @worksheet_name + '/cells/' + cell_name
|
757
|
+
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
758
|
+
response = RestClient.get(signed_uri, :accept=>'application/json')
|
759
|
+
json = JSON.parse(response)
|
760
|
+
return json['Cell']
|
761
|
+
rescue Exception=>e
|
762
|
+
print e
|
763
|
+
return false
|
764
|
+
end
|
765
|
+
end
|
766
|
+
def get_cell_style(cell_name)
|
767
|
+
begin
|
768
|
+
if(@filename=='')
|
769
|
+
raise 'Base File Name is not specified'
|
770
|
+
end
|
771
|
+
if(@worksheet_name=='')
|
772
|
+
raise 'Worksheet Name is not specified'
|
773
|
+
end
|
774
|
+
str_uri = $product_uri+'/cells/' + @filename + '/worksheets/' + @worksheet_name + '/cells/' + cell_name + '/style'
|
775
|
+
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
776
|
+
response = RestClient.get(signed_uri, :accept => 'application/json')
|
777
|
+
json = JSON.parse(response)
|
778
|
+
return json['Style']
|
779
|
+
rescue Exception => e
|
780
|
+
print e
|
781
|
+
end
|
782
|
+
end
|
783
|
+
|
784
|
+
def add_picture(picture_path,picture_location, upper_left_row, upper_left_column, lower_right_row, lower_right_column)
|
785
|
+
begin
|
786
|
+
if(@filename=='')
|
787
|
+
raise 'Base File Name is not specified'
|
788
|
+
end
|
789
|
+
if(@worksheet_name=='')
|
790
|
+
raise 'Worksheet Name is not specified'
|
791
|
+
end
|
792
|
+
if(picture_location == 'Server' || picture_location == 'server')
|
793
|
+
str_uri = $product_uri + '/cells/' + @filename + '/worksheets/' + @worksheet_name + '/pictures?upperLeftRow=' +upper_left_row.to_s + '&upperLeftColumn=' + upper_left_column.to_s + '&lowerRightRow=' +lower_right_row.to_s + '&lowerRightColumn=' + lower_right_column.to_s + '&picturePath=' + picture_path
|
794
|
+
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
795
|
+
response = RestClient.put(signed_uri, :accept=>'application/json')
|
796
|
+
else
|
797
|
+
if(!File.exist?(picture_path))
|
798
|
+
raise "File doesn't exists"
|
799
|
+
end
|
800
|
+
str_uri = $product_uri + '/cells/' + @filename + '/worksheets/' + @worksheet_name + '/pictures?upperLeftRow=' +upper_left_row.to_s + '&upperLeftColumn=' + upper_left_column.to_s + '&lowerRightRow=' +lower_right_row.to_s + '&lowerRightColumn=' + lower_right_column.to_s
|
801
|
+
stream = File.new(picture_path,'rb')
|
802
|
+
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
803
|
+
response = RestClient.put(signed_uri,stream, :accept=>'application/json')
|
804
|
+
end
|
805
|
+
json = JSON.parse(response)
|
806
|
+
if(json['Code'] == 200)
|
807
|
+
return true
|
808
|
+
else
|
809
|
+
return false
|
810
|
+
end
|
811
|
+
rescue Exception=>e
|
812
|
+
print e
|
813
|
+
end
|
814
|
+
|
815
|
+
end
|
816
|
+
end
|
817
|
+
end
|
818
|
+
end
|
819
|
+
end
|