Class: AsposePdfCloud::Cell

Inherits:
Object
  • Object
show all
Defined in:
lib/aspose_pdf_cloud/models/cell.rb

Overview

Represents a cell of the table’s row.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Cell

Initializes the object

Parameters:

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

    Model attributes in the form of hash



123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
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
# File 'lib/aspose_pdf_cloud/models/cell.rb', line 123

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?(:'IsNoBorder')
    self.is_no_border = attributes[:'IsNoBorder']
  end

  if attributes.has_key?(:'Margin')
    self.margin = attributes[:'Margin']
  end

  if attributes.has_key?(:'Border')
    self.border = attributes[:'Border']
  end

  if attributes.has_key?(:'BackgroundColor')
    self.background_color = attributes[:'BackgroundColor']
  end

  if attributes.has_key?(:'BackgroundImageFile')
    self.background_image_file = attributes[:'BackgroundImageFile']
  end

  if attributes.has_key?(:'BackgroundImageStorageFile')
    self.background_image_storage_file = attributes[:'BackgroundImageStorageFile']
  end

  if attributes.has_key?(:'Alignment')
    self.alignment = attributes[:'Alignment']
  end

  if attributes.has_key?(:'DefaultCellTextState')
    self.default_cell_text_state = attributes[:'DefaultCellTextState']
  end

  if attributes.has_key?(:'Paragraphs')
    if (value = attributes[:'Paragraphs']).is_a?(Array)
      self.paragraphs = value
    end
  end

  if attributes.has_key?(:'IsWordWrapped')
    self.is_word_wrapped = attributes[:'IsWordWrapped']
  end

  if attributes.has_key?(:'VerticalAlignment')
    self.vertical_alignment = attributes[:'VerticalAlignment']
  end

  if attributes.has_key?(:'ColSpan')
    self.col_span = attributes[:'ColSpan']
  end

  if attributes.has_key?(:'RowSpan')
    self.row_span = attributes[:'RowSpan']
  end

  if attributes.has_key?(:'Width')
    self.width = attributes[:'Width']
  end

  if attributes.has_key?(:'HtmlFragment')
    self.html_fragment = attributes[:'HtmlFragment']
  end

  if attributes.has_key?(:'Images')
    if (value = attributes[:'Images']).is_a?(Array)
      self.images = value
    end
  end

end

Instance Attribute Details

#alignmentObject

Gets or sets the alignment.



47
48
49
# File 'lib/aspose_pdf_cloud/models/cell.rb', line 47

def alignment
  @alignment
end

#background_colorObject

Gets or sets the background color.



38
39
40
# File 'lib/aspose_pdf_cloud/models/cell.rb', line 38

def background_color
  @background_color
end

#background_image_fileObject

Gets or sets the background image file.



41
42
43
# File 'lib/aspose_pdf_cloud/models/cell.rb', line 41

def background_image_file
  @background_image_file
end

#background_image_storage_fileObject

Gets or sets path of the background image file from storage.



44
45
46
# File 'lib/aspose_pdf_cloud/models/cell.rb', line 44

def background_image_storage_file
  @background_image_storage_file
end

#borderObject

Gets or sets the border.



35
36
37
# File 'lib/aspose_pdf_cloud/models/cell.rb', line 35

def border
  @border
end

#col_spanObject

Gets or sets the column span.



62
63
64
# File 'lib/aspose_pdf_cloud/models/cell.rb', line 62

def col_span
  @col_span
end

#default_cell_text_stateObject

Gets or sets the default cell text state.



50
51
52
# File 'lib/aspose_pdf_cloud/models/cell.rb', line 50

def default_cell_text_state
  @default_cell_text_state
end

#html_fragmentObject

Gets or sets Html fragment.



71
72
73
# File 'lib/aspose_pdf_cloud/models/cell.rb', line 71

def html_fragment
  @html_fragment
end

#imagesObject

Gets or sets ImageFragment list.



74
75
76
# File 'lib/aspose_pdf_cloud/models/cell.rb', line 74

def images
  @images
end

#is_no_borderObject

Gets or sets the cell have border.



29
30
31
# File 'lib/aspose_pdf_cloud/models/cell.rb', line 29

def is_no_border
  @is_no_border
end

#is_word_wrappedObject

Gets or sets the cell’s text word wrapped.



56
57
58
# File 'lib/aspose_pdf_cloud/models/cell.rb', line 56

def is_word_wrapped
  @is_word_wrapped
end

#marginObject

Gets or sets the padding.



32
33
34
# File 'lib/aspose_pdf_cloud/models/cell.rb', line 32

def margin
  @margin
end

#paragraphsObject

Gets or sets the cell’s formatted text.



53
54
55
# File 'lib/aspose_pdf_cloud/models/cell.rb', line 53

def paragraphs
  @paragraphs
end

#row_spanObject

Gets or sets the row span.



65
66
67
# File 'lib/aspose_pdf_cloud/models/cell.rb', line 65

def row_span
  @row_span
end

#vertical_alignmentObject

Gets or sets the vertical alignment.



59
60
61
# File 'lib/aspose_pdf_cloud/models/cell.rb', line 59

def vertical_alignment
  @vertical_alignment
end

#widthObject

Gets or sets the column width.



68
69
70
# File 'lib/aspose_pdf_cloud/models/cell.rb', line 68

def width
  @width
end

Class Method Details

.attribute_mapObject

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



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/aspose_pdf_cloud/models/cell.rb', line 78

def self.attribute_map
  {
    :'is_no_border' => :'IsNoBorder',
    :'margin' => :'Margin',
    :'border' => :'Border',
    :'background_color' => :'BackgroundColor',
    :'background_image_file' => :'BackgroundImageFile',
    :'background_image_storage_file' => :'BackgroundImageStorageFile',
    :'alignment' => :'Alignment',
    :'default_cell_text_state' => :'DefaultCellTextState',
    :'paragraphs' => :'Paragraphs',
    :'is_word_wrapped' => :'IsWordWrapped',
    :'vertical_alignment' => :'VerticalAlignment',
    :'col_span' => :'ColSpan',
    :'row_span' => :'RowSpan',
    :'width' => :'Width',
    :'html_fragment' => :'HtmlFragment',
    :'images' => :'Images'
  }
end

.swagger_typesObject

Attribute type mapping.



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/aspose_pdf_cloud/models/cell.rb', line 100

def self.swagger_types
  {
    :'is_no_border' => :'BOOLEAN',
    :'margin' => :'MarginInfo',
    :'border' => :'BorderInfo',
    :'background_color' => :'Color',
    :'background_image_file' => :'String',
    :'background_image_storage_file' => :'String',
    :'alignment' => :'HorizontalAlignment',
    :'default_cell_text_state' => :'TextState',
    :'paragraphs' => :'Array<TextRect>',
    :'is_word_wrapped' => :'BOOLEAN',
    :'vertical_alignment' => :'VerticalAlignment',
    :'col_span' => :'Integer',
    :'row_span' => :'Integer',
    :'width' => :'Float',
    :'html_fragment' => :'String',
    :'images' => :'Array<ImageFragment>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# File 'lib/aspose_pdf_cloud/models/cell.rb', line 214

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      is_no_border == o.is_no_border &&
      margin == o.margin &&
      border == o.border &&
      background_color == o.background_color &&
      background_image_file == o.background_image_file &&
      background_image_storage_file == o.background_image_storage_file &&
      alignment == o.alignment &&
      default_cell_text_state == o.default_cell_text_state &&
      paragraphs == o.paragraphs &&
      is_word_wrapped == o.is_word_wrapped &&
      vertical_alignment == o.vertical_alignment &&
      col_span == o.col_span &&
      row_span == o.row_span &&
      width == o.width &&
      html_fragment == o.html_fragment &&
      images == o.images
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



271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
# File 'lib/aspose_pdf_cloud/models/cell.rb', line 271

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 = AsposePdfCloud.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



337
338
339
340
341
342
343
344
345
346
347
348
349
# File 'lib/aspose_pdf_cloud/models/cell.rb', line 337

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



250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
# File 'lib/aspose_pdf_cloud/models/cell.rb', line 250

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


237
238
239
# File 'lib/aspose_pdf_cloud/models/cell.rb', line 237

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



243
244
245
# File 'lib/aspose_pdf_cloud/models/cell.rb', line 243

def hash
  [is_no_border, margin, border, background_color, background_image_file, background_image_storage_file, alignment, default_cell_text_state, paragraphs, is_word_wrapped, vertical_alignment, col_span, row_span, width, html_fragment, images].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properies with the reasons



201
202
203
204
# File 'lib/aspose_pdf_cloud/models/cell.rb', line 201

def list_invalid_properties
  invalid_properties = Array.new
  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



317
318
319
# File 'lib/aspose_pdf_cloud/models/cell.rb', line 317

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



323
324
325
326
327
328
329
330
331
# File 'lib/aspose_pdf_cloud/models/cell.rb', line 323

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



311
312
313
# File 'lib/aspose_pdf_cloud/models/cell.rb', line 311

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



208
209
210
# File 'lib/aspose_pdf_cloud/models/cell.rb', line 208

def valid?
  return true
end