Class: AsposePdfCloud::Table

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

Overview

Represents a table that can be added to the page.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Table

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
218
219
220
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
# File 'lib/aspose_pdf_cloud/models/table.rb', line 163

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?(:'Links')
    if (value = attributes[:'Links']).is_a?(Array)
      self.links = value
    end
  end

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

  if attributes.has_key?(:'HorizontalAlignment')
    self.horizontal_alignment = attributes[:'HorizontalAlignment']
  end

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

  if attributes.has_key?(:'Top')
    self.top = attributes[:'Top']
  end

  if attributes.has_key?(:'Left')
    self.left = attributes[:'Left']
  end

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

  if attributes.has_key?(:'DefaultCellPadding')
    self.default_cell_padding = attributes[:'DefaultCellPadding']
  end

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

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

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

  if attributes.has_key?(:'DefaultColumnWidth')
    self.default_column_width = attributes[:'DefaultColumnWidth']
  end

  if attributes.has_key?(:'DefaultCellBorder')
    self.default_cell_border = attributes[:'DefaultCellBorder']
  end

  if attributes.has_key?(:'Broken')
    self.broken = attributes[:'Broken']
  end

  if attributes.has_key?(:'ColumnWidths')
    self.column_widths = attributes[:'ColumnWidths']
  end

  if attributes.has_key?(:'RepeatingRowsCount')
    self.repeating_rows_count = attributes[:'RepeatingRowsCount']
  end

  if attributes.has_key?(:'RepeatingColumnsCount')
    self.repeating_columns_count = attributes[:'RepeatingColumnsCount']
  end

  if attributes.has_key?(:'RepeatingRowsStyle')
    self.repeating_rows_style = attributes[:'RepeatingRowsStyle']
  end

  if attributes.has_key?(:'CornerStyle')
    self.corner_style = attributes[:'CornerStyle']
  end

  if attributes.has_key?(:'BreakText')
    self.break_text = attributes[:'BreakText']
  end

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

  if attributes.has_key?(:'IsBordersIncluded')
    self.is_borders_included = attributes[:'IsBordersIncluded']
  end

  if attributes.has_key?(:'ColumnAdjustment')
    self.column_adjustment = attributes[:'ColumnAdjustment']
  end

  if attributes.has_key?(:'ZIndex')
    self.z_index = attributes[:'ZIndex']
  end

end

Instance Attribute Details

#alignmentObject

Gets HorizontalAlignment of the table alignment.



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

def alignment
  @alignment
end

#background_colorObject

Gets or sets table background color



89
90
91
# File 'lib/aspose_pdf_cloud/models/table.rb', line 89

def background_color
  @background_color
end

#borderObject

Gets or sets the border.



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

def border
  @border
end

#break_textObject

Gets or sets break text for table



86
87
88
# File 'lib/aspose_pdf_cloud/models/table.rb', line 86

def break_text
  @break_text
end

#brokenObject

Gets or sets table vertial broken;



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

def broken
  @broken
end

#column_adjustmentObject

Gets or sets the table column adjustment.



95
96
97
# File 'lib/aspose_pdf_cloud/models/table.rb', line 95

def column_adjustment
  @column_adjustment
end

#column_widthsObject

Gets the column widths of the table.



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

def column_widths
  @column_widths
end

#corner_styleObject

Gets or sets the styles of the border corners



83
84
85
# File 'lib/aspose_pdf_cloud/models/table.rb', line 83

def corner_style
  @corner_style
end

#default_cell_borderObject

Gets default cell border;



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

def default_cell_border
  @default_cell_border
end

#default_cell_paddingObject

Gets or sets the default cell padding.



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

def default_cell_padding
  @default_cell_padding
end

#default_cell_text_stateObject

Gets or sets the default cell text state.



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

def default_cell_text_state
  @default_cell_text_state
end

#default_column_widthObject

Gets default cell border;



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

def default_column_width
  @default_column_width
end

#horizontal_alignmentObject

Gets HorizontalAlignment of the table alignment.



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

def horizontal_alignment
  @horizontal_alignment
end

#is_borders_includedObject

Gets or sets border included in column widhts.



92
93
94
# File 'lib/aspose_pdf_cloud/models/table.rb', line 92

def is_borders_included
  @is_borders_included
end

#leftObject

Gets or sets the table left coordinate.



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

def left
  @left
end

Link to the document.



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

def links
  @links
end

#marginObject

Gets or sets a outer margin for paragraph (for pdf generation)



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

def margin
  @margin
end

#repeating_columns_countObject

Gets or sets the maximum columns count for table



77
78
79
# File 'lib/aspose_pdf_cloud/models/table.rb', line 77

def repeating_columns_count
  @repeating_columns_count
end

#repeating_rows_countObject

Gets the first rows count repeated for several pages



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

def repeating_rows_count
  @repeating_rows_count
end

#repeating_rows_styleObject

Gets the style for repeating rows



80
81
82
# File 'lib/aspose_pdf_cloud/models/table.rb', line 80

def repeating_rows_style
  @repeating_rows_style
end

#rowsObject

Sets the rows of the table.



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

def rows
  @rows
end

#topObject

Gets or sets the table top coordinate.



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

def top
  @top
end

#vertical_alignmentObject

Gets VerticalAlignment of the annotation.



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

def vertical_alignment
  @vertical_alignment
end

#z_indexObject

Gets ZIndex of the annotation.



98
99
100
# File 'lib/aspose_pdf_cloud/models/table.rb', line 98

def z_index
  @z_index
end

Class Method Details

.attribute_mapObject

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



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/aspose_pdf_cloud/models/table.rb', line 102

def self.attribute_map
  {
    :'links' => :'Links',
    :'alignment' => :'Alignment',
    :'horizontal_alignment' => :'HorizontalAlignment',
    :'vertical_alignment' => :'VerticalAlignment',
    :'top' => :'Top',
    :'left' => :'Left',
    :'default_cell_text_state' => :'DefaultCellTextState',
    :'default_cell_padding' => :'DefaultCellPadding',
    :'border' => :'Border',
    :'margin' => :'Margin',
    :'rows' => :'Rows',
    :'default_column_width' => :'DefaultColumnWidth',
    :'default_cell_border' => :'DefaultCellBorder',
    :'broken' => :'Broken',
    :'column_widths' => :'ColumnWidths',
    :'repeating_rows_count' => :'RepeatingRowsCount',
    :'repeating_columns_count' => :'RepeatingColumnsCount',
    :'repeating_rows_style' => :'RepeatingRowsStyle',
    :'corner_style' => :'CornerStyle',
    :'break_text' => :'BreakText',
    :'background_color' => :'BackgroundColor',
    :'is_borders_included' => :'IsBordersIncluded',
    :'column_adjustment' => :'ColumnAdjustment',
    :'z_index' => :'ZIndex'
  }
end

.swagger_typesObject

Attribute type mapping.



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
# File 'lib/aspose_pdf_cloud/models/table.rb', line 132

def self.swagger_types
  {
    :'links' => :'Array<Link>',
    :'alignment' => :'HorizontalAlignment',
    :'horizontal_alignment' => :'HorizontalAlignment',
    :'vertical_alignment' => :'VerticalAlignment',
    :'top' => :'Float',
    :'left' => :'Float',
    :'default_cell_text_state' => :'TextState',
    :'default_cell_padding' => :'MarginInfo',
    :'border' => :'BorderInfo',
    :'margin' => :'MarginInfo',
    :'rows' => :'Array<Row>',
    :'default_column_width' => :'String',
    :'default_cell_border' => :'BorderInfo',
    :'broken' => :'TableBroken',
    :'column_widths' => :'String',
    :'repeating_rows_count' => :'Integer',
    :'repeating_columns_count' => :'Integer',
    :'repeating_rows_style' => :'TextState',
    :'corner_style' => :'BorderCornerStyle',
    :'break_text' => :'TextRect',
    :'background_color' => :'Color',
    :'is_borders_included' => :'BOOLEAN',
    :'column_adjustment' => :'ColumnAdjustment',
    :'z_index' => :'Integer'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
# File 'lib/aspose_pdf_cloud/models/table.rb', line 291

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      links == o.links &&
      alignment == o.alignment &&
      horizontal_alignment == o.horizontal_alignment &&
      vertical_alignment == o.vertical_alignment &&
      top == o.top &&
      left == o.left &&
      default_cell_text_state == o.default_cell_text_state &&
      default_cell_padding == o.default_cell_padding &&
      border == o.border &&
      margin == o.margin &&
      rows == o.rows &&
      default_column_width == o.default_column_width &&
      default_cell_border == o.default_cell_border &&
      broken == o.broken &&
      column_widths == o.column_widths &&
      repeating_rows_count == o.repeating_rows_count &&
      repeating_columns_count == o.repeating_columns_count &&
      repeating_rows_style == o.repeating_rows_style &&
      corner_style == o.corner_style &&
      break_text == o.break_text &&
      background_color == o.background_color &&
      is_borders_included == o.is_borders_included &&
      column_adjustment == o.column_adjustment &&
      z_index == o.z_index
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



356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
# File 'lib/aspose_pdf_cloud/models/table.rb', line 356

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



422
423
424
425
426
427
428
429
430
431
432
433
434
# File 'lib/aspose_pdf_cloud/models/table.rb', line 422

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



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

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


322
323
324
# File 'lib/aspose_pdf_cloud/models/table.rb', line 322

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



328
329
330
# File 'lib/aspose_pdf_cloud/models/table.rb', line 328

def hash
  [links, alignment, horizontal_alignment, vertical_alignment, top, left, default_cell_text_state, default_cell_padding, border, margin, rows, default_column_width, default_cell_border, broken, column_widths, repeating_rows_count, repeating_columns_count, repeating_rows_style, corner_style, break_text, background_color, is_borders_included, column_adjustment, z_index].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properies with the reasons



273
274
275
276
277
278
279
280
# File 'lib/aspose_pdf_cloud/models/table.rb', line 273

def list_invalid_properties
  invalid_properties = Array.new
  if @rows.nil?
    invalid_properties.push("invalid value for 'rows', rows 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



402
403
404
# File 'lib/aspose_pdf_cloud/models/table.rb', line 402

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



408
409
410
411
412
413
414
415
416
# File 'lib/aspose_pdf_cloud/models/table.rb', line 408

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



396
397
398
# File 'lib/aspose_pdf_cloud/models/table.rb', line 396

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



284
285
286
287
# File 'lib/aspose_pdf_cloud/models/table.rb', line 284

def valid?
  return false if @rows.nil?
  return true
end