Class: AsposeCellsCloud::Style

Inherits:
Object
  • Object
show all
Defined in:
lib/aspose_cells_cloud/models/style.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Style

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
# File 'lib/aspose_cells_cloud/models/style.rb', line 141

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}

  if attributes.has_key?(:'Font')
      self.font = attributes[:'Font']
  end
  if attributes.has_key?(:'Name')
      self.name = attributes[:'Name']
  end
  if attributes.has_key?(:'CultureCustom')
      self.culture_custom = attributes[:'CultureCustom']
  end
  if attributes.has_key?(:'Custom')
      self.custom = attributes[:'Custom']
  end
  if attributes.has_key?(:'BackgroundColor')
      self.background_color = attributes[:'BackgroundColor']
  end
  if attributes.has_key?(:'ForegroundColor')
      self.foreground_color = attributes[:'ForegroundColor']
  end
  if attributes.has_key?(:'IsFormulaHidden')
      self.is_formula_hidden = attributes[:'IsFormulaHidden']
  end
  if attributes.has_key?(:'IsDateTime')
      self.is_date_time = attributes[:'IsDateTime']
  end
  if attributes.has_key?(:'IsTextWrapped')
      self.is_text_wrapped = attributes[:'IsTextWrapped']
  end
  if attributes.has_key?(:'IsGradient')
      self.is_gradient = attributes[:'IsGradient']
  end
  if attributes.has_key?(:'IsLocked')
      self.is_locked = attributes[:'IsLocked']
  end
  if attributes.has_key?(:'IsPercent')
      self.is_percent = attributes[:'IsPercent']
  end
  if attributes.has_key?(:'ShrinkToFit')
      self.shrink_to_fit = attributes[:'ShrinkToFit']
  end
  if attributes.has_key?(:'IndentLevel')
      self.indent_level = attributes[:'IndentLevel']
  end
  if attributes.has_key?(:'Number')
      self.number = attributes[:'Number']
  end
  if attributes.has_key?(:'RotationAngle')
      self.rotation_angle = attributes[:'RotationAngle']
  end
  if attributes.has_key?(:'Pattern')
      self.pattern = attributes[:'Pattern']
  end
  if attributes.has_key?(:'TextDirection')
      self.text_direction = attributes[:'TextDirection']
  end
  if attributes.has_key?(:'VerticalAlignment')
      self.vertical_alignment = attributes[:'VerticalAlignment']
  end
  if attributes.has_key?(:'HorizontalAlignment')
      self.horizontal_alignment = attributes[:'HorizontalAlignment']
  end
  if attributes.has_key?(:'BorderCollection')
      self.border_collection = attributes[:'BorderCollection']
  end
  if attributes.has_key?(:'BackgroundThemeColor')
      self.background_theme_color = attributes[:'BackgroundThemeColor']
  end
  if attributes.has_key?(:'ForegroundThemeColor')
      self.foreground_theme_color = attributes[:'ForegroundThemeColor']
  end

end

Instance Attribute Details

#background_colorObject

Gets or sets a style’s background color.



43
44
45
# File 'lib/aspose_cells_cloud/models/style.rb', line 43

def background_color
  @background_color
end

#background_theme_colorObject

Gets and sets the background theme color.



77
78
79
# File 'lib/aspose_cells_cloud/models/style.rb', line 77

def background_theme_color
  @background_theme_color
end

#border_collectionObject

Returns the value of attribute border_collection.



75
76
77
# File 'lib/aspose_cells_cloud/models/style.rb', line 75

def border_collection
  @border_collection
end

#culture_customObject

Gets and sets the culture-dependent pattern string for number format. If no number format has been set for this object, null will be returned. If number format is builtin, the pattern string corresponding to the builtin number will be returned.



39
40
41
# File 'lib/aspose_cells_cloud/models/style.rb', line 39

def culture_custom
  @culture_custom
end

#customObject

Represents the custom number format string of this style object. If the custom number format is not set(For example, the number format is builtin), “” will be returned.



41
42
43
# File 'lib/aspose_cells_cloud/models/style.rb', line 41

def custom
  @custom
end

#fontObject

Gets a object.



35
36
37
# File 'lib/aspose_cells_cloud/models/style.rb', line 35

def font
  @font
end

#foreground_colorObject

Gets or sets a style’s foreground color.



45
46
47
# File 'lib/aspose_cells_cloud/models/style.rb', line 45

def foreground_color
  @foreground_color
end

#foreground_theme_colorObject

Gets and sets the foreground theme color.



79
80
81
# File 'lib/aspose_cells_cloud/models/style.rb', line 79

def foreground_theme_color
  @foreground_theme_color
end

#horizontal_alignmentObject

Gets or sets the horizontal alignment type of the text in a cell.



73
74
75
# File 'lib/aspose_cells_cloud/models/style.rb', line 73

def horizontal_alignment
  @horizontal_alignment
end

#indent_levelObject

Represents the indent level for the cell or range. Can only be an integer from 0 to 250.



61
62
63
# File 'lib/aspose_cells_cloud/models/style.rb', line 61

def indent_level
  @indent_level
end

#is_date_timeObject

Indicates whether the number format is a date format.



49
50
51
# File 'lib/aspose_cells_cloud/models/style.rb', line 49

def is_date_time
  @is_date_time
end

#is_formula_hiddenObject

Represents if the formula will be hidden when the worksheet is protected.



47
48
49
# File 'lib/aspose_cells_cloud/models/style.rb', line 47

def is_formula_hidden
  @is_formula_hidden
end

#is_gradientObject

Indicates whether the cell shading is a gradient pattern.



53
54
55
# File 'lib/aspose_cells_cloud/models/style.rb', line 53

def is_gradient
  @is_gradient
end

#is_lockedObject

Gets or sets a value indicating whether a cell can be modified or not.



55
56
57
# File 'lib/aspose_cells_cloud/models/style.rb', line 55

def is_locked
  @is_locked
end

#is_percentObject

Indicates whether the number format is a percent format.



57
58
59
# File 'lib/aspose_cells_cloud/models/style.rb', line 57

def is_percent
  @is_percent
end

#is_text_wrappedObject

Gets or sets a value indicating whether the text within a cell is wrapped.



51
52
53
# File 'lib/aspose_cells_cloud/models/style.rb', line 51

def is_text_wrapped
  @is_text_wrapped
end

#nameObject

Gets or sets the name of the style.



37
38
39
# File 'lib/aspose_cells_cloud/models/style.rb', line 37

def name
  @name
end

#numberObject

Gets or sets the display format of numbers and dates. The formatting patterns are different for different regions.



63
64
65
# File 'lib/aspose_cells_cloud/models/style.rb', line 63

def number
  @number
end

#patternObject

Gets or sets the cell background pattern type.



67
68
69
# File 'lib/aspose_cells_cloud/models/style.rb', line 67

def pattern
  @pattern
end

#rotation_angleObject

Represents text rotation angle.



65
66
67
# File 'lib/aspose_cells_cloud/models/style.rb', line 65

def rotation_angle
  @rotation_angle
end

#shrink_to_fitObject

Represents if text automatically shrinks to fit in the available column width.



59
60
61
# File 'lib/aspose_cells_cloud/models/style.rb', line 59

def shrink_to_fit
  @shrink_to_fit
end

#text_directionObject

Represents text reading order.



69
70
71
# File 'lib/aspose_cells_cloud/models/style.rb', line 69

def text_direction
  @text_direction
end

#vertical_alignmentObject

Gets or sets the vertical alignment type of the text in a cell.



71
72
73
# File 'lib/aspose_cells_cloud/models/style.rb', line 71

def vertical_alignment
  @vertical_alignment
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/aspose_cells_cloud/models/style.rb', line 82

def self.attribute_map
  {
    :'font' => :'Font',
    :'name' => :'Name',
    :'culture_custom' => :'CultureCustom',
    :'custom' => :'Custom',
    :'background_color' => :'BackgroundColor',
    :'foreground_color' => :'ForegroundColor',
    :'is_formula_hidden' => :'IsFormulaHidden',
    :'is_date_time' => :'IsDateTime',
    :'is_text_wrapped' => :'IsTextWrapped',
    :'is_gradient' => :'IsGradient',
    :'is_locked' => :'IsLocked',
    :'is_percent' => :'IsPercent',
    :'shrink_to_fit' => :'ShrinkToFit',
    :'indent_level' => :'IndentLevel',
    :'number' => :'Number',
    :'rotation_angle' => :'RotationAngle',
    :'pattern' => :'Pattern',
    :'text_direction' => :'TextDirection',
    :'vertical_alignment' => :'VerticalAlignment',
    :'horizontal_alignment' => :'HorizontalAlignment',
    :'border_collection' => :'BorderCollection',
    :'background_theme_color' => :'BackgroundThemeColor',
    :'foreground_theme_color' => :'ForegroundThemeColor'
  }
end

.swagger_typesObject

Attribute type mapping.



111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/aspose_cells_cloud/models/style.rb', line 111

def self.swagger_types
  {
    :'font' => :'Font',
    :'name' => :'String',
    :'culture_custom' => :'String',
    :'custom' => :'String',
    :'background_color' => :'Color',
    :'foreground_color' => :'Color',
    :'is_formula_hidden' => :'BOOLEAN',
    :'is_date_time' => :'BOOLEAN',
    :'is_text_wrapped' => :'BOOLEAN',
    :'is_gradient' => :'BOOLEAN',
    :'is_locked' => :'BOOLEAN',
    :'is_percent' => :'BOOLEAN',
    :'shrink_to_fit' => :'BOOLEAN',
    :'indent_level' => :'Integer',
    :'number' => :'Integer',
    :'rotation_angle' => :'Integer',
    :'pattern' => :'String',
    :'text_direction' => :'String',
    :'vertical_alignment' => :'String',
    :'horizontal_alignment' => :'String',
    :'border_collection' => :'Array<Border>',
    :'background_theme_color' => :'ThemeColor',
    :'foreground_theme_color' => :'ThemeColor'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
# File 'lib/aspose_cells_cloud/models/style.rb', line 327

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      font == o.font &&
      name == o.name &&
      culture_custom == o.culture_custom &&
      custom == o.custom &&
      background_color == o.background_color &&
      foreground_color == o.foreground_color &&
      is_formula_hidden == o.is_formula_hidden &&
      is_date_time == o.is_date_time &&
      is_text_wrapped == o.is_text_wrapped &&
      is_gradient == o.is_gradient &&
      is_locked == o.is_locked &&
      is_percent == o.is_percent &&
      shrink_to_fit == o.shrink_to_fit &&
      indent_level == o.indent_level &&
      number == o.number &&
      rotation_angle == o.rotation_angle &&
      pattern == o.pattern &&
      text_direction == o.text_direction &&
      vertical_alignment == o.vertical_alignment &&
      horizontal_alignment == o.horizontal_alignment &&
      border_collection == o.border_collection &&
      background_theme_color == o.background_theme_color &&
      foreground_theme_color == o.foreground_theme_color 
      std_dev == o.std_dev
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
# File 'lib/aspose_cells_cloud/models/style.rb', line 392

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :BOOLEAN
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    temp_model = AsposeCellsCloud.const_get(type).new
    temp_model.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



458
459
460
461
462
463
464
465
466
467
468
469
470
# File 'lib/aspose_cells_cloud/models/style.rb', line 458

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map{ |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
# File 'lib/aspose_cells_cloud/models/style.rb', line 371

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.swagger_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


358
359
360
# File 'lib/aspose_cells_cloud/models/style.rb', line 358

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



364
365
366
# File 'lib/aspose_cells_cloud/models/style.rb', line 364

def hash
  [ font , name , culture_custom , custom , background_color , foreground_color , is_formula_hidden , is_date_time , is_text_wrapped , is_gradient , is_locked , is_percent , shrink_to_fit , indent_level , number , rotation_angle , pattern , text_direction , vertical_alignment , horizontal_alignment , border_collection , background_theme_color , foreground_theme_color ].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properies with the reasons



221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
# File 'lib/aspose_cells_cloud/models/style.rb', line 221

def list_invalid_properties
  invalid_properties = Array.new
  if @font.nil?
      invalid_properties.push("invalid value for 'font', font cannot be nil.")
  end
  if @name.nil?
      invalid_properties.push("invalid value for 'name', name cannot be nil.")
  end
  if @culture_custom.nil?
      invalid_properties.push("invalid value for 'culture_custom', culture_custom cannot be nil.")
  end
  if @custom.nil?
      invalid_properties.push("invalid value for 'custom', custom cannot be nil.")
  end
  if @background_color.nil?
      invalid_properties.push("invalid value for 'background_color', background_color cannot be nil.")
  end
  if @foreground_color.nil?
      invalid_properties.push("invalid value for 'foreground_color', foreground_color cannot be nil.")
  end
  if @is_formula_hidden.nil?
      invalid_properties.push("invalid value for 'is_formula_hidden', is_formula_hidden cannot be nil.")
  end
  if @is_date_time.nil?
      invalid_properties.push("invalid value for 'is_date_time', is_date_time cannot be nil.")
  end
  if @is_text_wrapped.nil?
      invalid_properties.push("invalid value for 'is_text_wrapped', is_text_wrapped cannot be nil.")
  end
  if @is_gradient.nil?
      invalid_properties.push("invalid value for 'is_gradient', is_gradient cannot be nil.")
  end
  if @is_locked.nil?
      invalid_properties.push("invalid value for 'is_locked', is_locked cannot be nil.")
  end
  if @is_percent.nil?
      invalid_properties.push("invalid value for 'is_percent', is_percent cannot be nil.")
  end
  if @shrink_to_fit.nil?
      invalid_properties.push("invalid value for 'shrink_to_fit', shrink_to_fit cannot be nil.")
  end
  if @indent_level.nil?
      invalid_properties.push("invalid value for 'indent_level', indent_level cannot be nil.")
  end
  if @number.nil?
      invalid_properties.push("invalid value for 'number', number cannot be nil.")
  end
  if @rotation_angle.nil?
      invalid_properties.push("invalid value for 'rotation_angle', rotation_angle cannot be nil.")
  end
  if @pattern.nil?
      invalid_properties.push("invalid value for 'pattern', pattern cannot be nil.")
  end
  if @text_direction.nil?
      invalid_properties.push("invalid value for 'text_direction', text_direction cannot be nil.")
  end
  if @vertical_alignment.nil?
      invalid_properties.push("invalid value for 'vertical_alignment', vertical_alignment cannot be nil.")
  end
  if @horizontal_alignment.nil?
      invalid_properties.push("invalid value for 'horizontal_alignment', horizontal_alignment cannot be nil.")
  end
  if @border_collection.nil?
      invalid_properties.push("invalid value for 'border_collection', border_collection cannot be nil.")
  end
  if @background_theme_color.nil?
      invalid_properties.push("invalid value for 'background_theme_color', background_theme_color cannot be nil.")
  end
  if @foreground_theme_color.nil?
      invalid_properties.push("invalid value for 'foreground_theme_color', foreground_theme_color cannot be nil.")
  end

  return invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



438
439
440
# File 'lib/aspose_cells_cloud/models/style.rb', line 438

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



444
445
446
447
448
449
450
451
452
# File 'lib/aspose_cells_cloud/models/style.rb', line 444

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    next if value.nil?
    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



432
433
434
# File 'lib/aspose_cells_cloud/models/style.rb', line 432

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
# File 'lib/aspose_cells_cloud/models/style.rb', line 298

def valid?
  return false if @font.nil?
  return false if @name.nil?
  return false if @culture_custom.nil?
  return false if @custom.nil?
  return false if @background_color.nil?
  return false if @foreground_color.nil?
  return false if @is_formula_hidden.nil?
  return false if @is_date_time.nil?
  return false if @is_text_wrapped.nil?
  return false if @is_gradient.nil?
  return false if @is_locked.nil?
  return false if @is_percent.nil?
  return false if @shrink_to_fit.nil?
  return false if @indent_level.nil?
  return false if @number.nil?
  return false if @rotation_angle.nil?
  return false if @pattern.nil?
  return false if @text_direction.nil?
  return false if @vertical_alignment.nil?
  return false if @horizontal_alignment.nil?
  return false if @border_collection.nil?
  return false if @background_theme_color.nil?
  return false if @foreground_theme_color.nil?
  return true
end