Class: AsposeWordsCloud::StructuredDocumentTag

Inherits:
Object
  • Object
show all
Defined in:
lib/aspose_words_cloud/models/structured_document_tag.rb

Overview

DTO container with a StructuredDocumentTag.

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ StructuredDocumentTag

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
295
296
297
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
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
# File 'lib/aspose_words_cloud/models/structured_document_tag.rb', line 231

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

  if attributes.key?(:'NodeId')
    self.node_id = attributes[:'NodeId']
  end

  if attributes.key?(:'ListItems')
    if (value = attributes[:'ListItems']).is_a?(Array)
      self.list_items = value
    end
  end

  if attributes.key?(:'Checked')
    self.checked = attributes[:'Checked']
  end

  if attributes.key?(:'Appearance')
    self.appearance = attributes[:'Appearance']
  end

  if attributes.key?(:'DateDisplayLocale')
    self.date_display_locale = attributes[:'DateDisplayLocale']
  end

  if attributes.key?(:'DateDisplayFormat')
    self.date_display_format = attributes[:'DateDisplayFormat']
  end

  if attributes.key?(:'FullDate')
    self.full_date = attributes[:'FullDate']
  end

  if attributes.key?(:'Title')
    self.title = attributes[:'Title']
  end

  if attributes.key?(:'DateStorageFormat')
    self.date_storage_format = attributes[:'DateStorageFormat']
  end

  if attributes.key?(:'BuildingBlockGallery')
    self.building_block_gallery = attributes[:'BuildingBlockGallery']
  end

  if attributes.key?(:'BuildingBlockCategory')
    self.building_block_category = attributes[:'BuildingBlockCategory']
  end

  if attributes.key?(:'Multiline')
    self.multiline = attributes[:'Multiline']
  end

  if attributes.key?(:'Color')
    self.color = attributes[:'Color']
  end

  if attributes.key?(:'StyleName')
    self.style_name = attributes[:'StyleName']
  end

  if attributes.key?(:'CalendarType')
    self.calendar_type = attributes[:'CalendarType']
  end

  if attributes.key?(:'IsTemporary')
    self.is_temporary = attributes[:'IsTemporary']
  end

  if attributes.key?(:'PlaceholderName')
    self.placeholder_name = attributes[:'PlaceholderName']
  end

  if attributes.key?(:'LockContentControl')
    self.lock_content_control = attributes[:'LockContentControl']
  end

  if attributes.key?(:'LockContents')
    self.lock_contents = attributes[:'LockContents']
  end

  if attributes.key?(:'IsShowingPlaceholderText')
    self.is_showing_placeholder_text = attributes[:'IsShowingPlaceholderText']
  end

  if attributes.key?(:'Tag')
    self.tag = attributes[:'Tag']
  end

  if attributes.key?(:'Id')
    self.id = attributes[:'Id']
  end

  if attributes.key?(:'Level')
    self.level = attributes[:'Level']
  end

  if attributes.key?(:'SdtType')
    self.sdt_type = attributes[:'SdtType']
  end
end

Instance Attribute Details

#appearanceObject

Gets or sets the appearance of a structured document tag.



49
50
51
# File 'lib/aspose_words_cloud/models/structured_document_tag.rb', line 49

def appearance
  @appearance
end

#building_block_categoryObject

Gets or sets category of building block for this SDT node. Can not be null. Accessing this property will only work for Aspose.Words.Markup.SdtType.BuildingBlockGallery and Aspose.Words.Markup.SdtType.DocPartObj SDT types. It is read-only for SDT of the document part type. For all other SDT types exception will occur.



84
85
86
# File 'lib/aspose_words_cloud/models/structured_document_tag.rb', line 84

def building_block_category
  @building_block_category
end

Gets or sets type of building block for this SDT. Can not be null. Accessing this property will only work for Aspose.Words.Markup.SdtType.BuildingBlockGallery and Aspose.Words.Markup.SdtType.DocPartObj SDT types. It is read-only for SDT of the document part type. For all other SDT types exception will occur.



79
80
81
# File 'lib/aspose_words_cloud/models/structured_document_tag.rb', line 79

def building_block_gallery
  @building_block_gallery
end

#calendar_typeObject

Gets or sets the type of calendar for this SDT. Default is Aspose.Words.Markup.SdtCalendarType.Default. Accessing this property will only work for Aspose.Words.Markup.SdtType.Date SDT type. For all other SDT types exception will occur.



100
101
102
# File 'lib/aspose_words_cloud/models/structured_document_tag.rb', line 100

def calendar_type
  @calendar_type
end

#checkedObject

Gets or sets a value indicating whether current state of the Checkbox SDT. Default value for this property. Accessing this property will only work for Aspose.Words.Markup.SdtType.Checkbox SDT types. For all other SDT types exception will occur.



46
47
48
# File 'lib/aspose_words_cloud/models/structured_document_tag.rb', line 46

def checked
  @checked
end

#colorObject

Gets or sets the color of the structured document tag.



92
93
94
# File 'lib/aspose_words_cloud/models/structured_document_tag.rb', line 92

def color
  @color
end

#date_display_formatObject

Gets or sets String that represents the format in which dates are displayed. Can not be null. The dates for English (U.S.) is “mm/dd/yyyy”. Accessing this property will only work for Aspose.Words.Markup.SdtType.Date SDT type. For all other SDT types exception will occur.



59
60
61
# File 'lib/aspose_words_cloud/models/structured_document_tag.rb', line 59

def date_display_format
  @date_display_format
end

#date_display_localeObject

Gets or sets the language format for the date displayed in this SDT. Accessing this property will only work for Aspose.Words.Markup.SdtType.Date SDT type. For all other SDT types exception will occur.



54
55
56
# File 'lib/aspose_words_cloud/models/structured_document_tag.rb', line 54

def date_display_locale
  @date_display_locale
end

#date_storage_formatObject

Gets or sets format in which the date for a date SDT is stored when the SDT is bound to an XML node in the document’s data store. Default value is Aspose.Words.Markup.SdtDateStorageFormat.DateTime. Accessing this property will only work for Aspose.Words.Markup.SdtType.Date SDT type. For all other SDT types exception will occur.



73
74
75
# File 'lib/aspose_words_cloud/models/structured_document_tag.rb', line 73

def date_storage_format
  @date_storage_format
end

#full_dateObject

Gets or sets the full date and time last entered into this SDT. Accessing this property will only work for Aspose.Words.Markup.SdtType.Date SDT type. For all other SDT types exception will occur.



64
65
66
# File 'lib/aspose_words_cloud/models/structured_document_tag.rb', line 64

def full_date
  @full_date
end

#idObject

Gets or sets a unique read-only persistent numerical Id for this SDT. Id attribute shall follow these rules:

  • The document shall retain SDT ids only if the whole document is cloned Aspose.Words.Document.Clone.

  • During Aspose.Words.DocumentBase.ImportNode(Aspose.Words.Node,System.Boolean)

  • Id shall be retained if import does not cause conflicts with other SDT Ids in the target document.

  • If multiple SDT nodes specify the same decimal number value for the Id attribute, then the first SDT in the document shall maintain this original Id, and all subsequent

  • SDT nodes shall have new identifiers assigned to them when the document is loaded.

  • During standalone SDT Aspose.Words.Markup.StructuredDocumentTag.Clone(System.Boolean,Aspose.Words.INodeCloningListener) operation new unique ID will be generated for the cloned SDT node.

  • If Id is not specified in the source document, then the SDT node shall have a new unique identifier assigned to it when the document is loaded.



132
133
134
# File 'lib/aspose_words_cloud/models/structured_document_tag.rb', line 132

def id
  @id
end

#is_showing_placeholder_textObject

Gets or sets a value indicating whether the content of this SDT shall be interpreted to contain placeholder text (as opposed to regular text contents within the SDT). If set to true, this state shall be resumed (showing placeholder text) upon opening his document.



117
118
119
# File 'lib/aspose_words_cloud/models/structured_document_tag.rb', line 117

def is_showing_placeholder_text
  @is_showing_placeholder_text
end

#is_temporaryObject

Gets or sets a value indicating whether this SDT shall be removed from the WordProcessingML document when its contents are modified.



103
104
105
# File 'lib/aspose_words_cloud/models/structured_document_tag.rb', line 103

def is_temporary
  @is_temporary
end

#levelObject

Gets or sets the level at which this SDT occurs in the document tree.



138
139
140
# File 'lib/aspose_words_cloud/models/structured_document_tag.rb', line 138

def level
  @level
end

Gets or sets the link to the document.



33
34
35
# File 'lib/aspose_words_cloud/models/structured_document_tag.rb', line 33

def link
  @link
end

#list_itemsObject

Gets or sets Aspose.Words.Markup.SdtListItemCollection associated with this SDT. Accessing this property will only work for Aspose.Words.Markup.SdtType.ComboBox or Aspose.Words.Markup.SdtType.DropDownList SDT types. For all other SDT types exception will occur.



41
42
43
# File 'lib/aspose_words_cloud/models/structured_document_tag.rb', line 41

def list_items
  @list_items
end

#lock_content_controlObject

Gets or sets a value indicating whether, this property will prohibit a user from deleting this SDT.



110
111
112
# File 'lib/aspose_words_cloud/models/structured_document_tag.rb', line 110

def lock_content_control
  @lock_content_control
end

#lock_contentsObject

Gets or sets a value indicating whether, this property will prohibit a user from editing the contents of this SDT.



113
114
115
# File 'lib/aspose_words_cloud/models/structured_document_tag.rb', line 113

def lock_contents
  @lock_contents
end

#multilineObject

Gets or sets a value indicating whether this SDT allows multiple lines of text. Accessing this property will only work for Aspose.Words.Markup.SdtType.RichText and Aspose.Words.Markup.SdtType.PlainText SDT type. For all other SDT types exception will occur.



89
90
91
# File 'lib/aspose_words_cloud/models/structured_document_tag.rb', line 89

def multiline
  @multiline
end

#node_idObject

Gets or sets the node id.



36
37
38
# File 'lib/aspose_words_cloud/models/structured_document_tag.rb', line 36

def node_id
  @node_id
end

#placeholder_nameObject

Gets or sets Name of the Aspose.Words.BuildingBlocks.BuildingBlock containing placeholder text. Aspose.Words.BuildingBlocks.BuildingBlock with this name Aspose.Words.BuildingBlocks.BuildingBlock.Name has to be present in the Aspose.Words.Document.GlossaryDocument otherwise System.InvalidOperationException will occur.



107
108
109
# File 'lib/aspose_words_cloud/models/structured_document_tag.rb', line 107

def placeholder_name
  @placeholder_name
end

#sdt_typeObject

Gets or sets type of this Structured document tag.



141
142
143
# File 'lib/aspose_words_cloud/models/structured_document_tag.rb', line 141

def sdt_type
  @sdt_type
end

#style_nameObject

Gets or sets the name of the style applied to the structured document tag.



95
96
97
# File 'lib/aspose_words_cloud/models/structured_document_tag.rb', line 95

def style_name
  @style_name
end

#tagObject

Gets or sets a tag associated with the current SDT node. Can not be null. A tag is an arbitrary string which applications can associate with SDT in order to identify it without providing a visible friendly name.



121
122
123
# File 'lib/aspose_words_cloud/models/structured_document_tag.rb', line 121

def tag
  @tag
end

#titleObject

Gets or sets the friendly name associated with this SDT. Can not be null.



67
68
69
# File 'lib/aspose_words_cloud/models/structured_document_tag.rb', line 67

def title
  @title
end

#word_open_xmlObject

Gets a string that represents the XML contained within the node in the Aspose.Words.SaveFormat.FlatOpc format.



135
136
137
# File 'lib/aspose_words_cloud/models/structured_document_tag.rb', line 135

def word_open_xml
  @word_open_xml
end

Class Method Details

.attribute_mapObject

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



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
# File 'lib/aspose_words_cloud/models/structured_document_tag.rb', line 166

def self.attribute_map
  {
    :'link' => :'Link',
    :'node_id' => :'NodeId',
    :'list_items' => :'ListItems',
    :'checked' => :'Checked',
    :'appearance' => :'Appearance',
    :'date_display_locale' => :'DateDisplayLocale',
    :'date_display_format' => :'DateDisplayFormat',
    :'full_date' => :'FullDate',
    :'title' => :'Title',
    :'date_storage_format' => :'DateStorageFormat',
    :'building_block_gallery' => :'BuildingBlockGallery',
    :'building_block_category' => :'BuildingBlockCategory',
    :'multiline' => :'Multiline',
    :'color' => :'Color',
    :'style_name' => :'StyleName',
    :'calendar_type' => :'CalendarType',
    :'is_temporary' => :'IsTemporary',
    :'placeholder_name' => :'PlaceholderName',
    :'lock_content_control' => :'LockContentControl',
    :'lock_contents' => :'LockContents',
    :'is_showing_placeholder_text' => :'IsShowingPlaceholderText',
    :'tag' => :'Tag',
    :'id' => :'Id',
    :'word_open_xml' => :'WordOpenXML',
    :'level' => :'Level',
    :'sdt_type' => :'SdtType'
  }
end

.swagger_typesObject

Attribute type mapping.



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
# File 'lib/aspose_words_cloud/models/structured_document_tag.rb', line 198

def self.swagger_types
  {
    :'link' => :'WordsApiLink',
    :'node_id' => :'String',
    :'list_items' => :'Array<StructuredDocumentTagListItem>',
    :'checked' => :'BOOLEAN',
    :'appearance' => :'String',
    :'date_display_locale' => :'Integer',
    :'date_display_format' => :'String',
    :'full_date' => :'DateTime',
    :'title' => :'String',
    :'date_storage_format' => :'String',
    :'building_block_gallery' => :'String',
    :'building_block_category' => :'String',
    :'multiline' => :'BOOLEAN',
    :'color' => :'XmlColor',
    :'style_name' => :'String',
    :'calendar_type' => :'String',
    :'is_temporary' => :'BOOLEAN',
    :'placeholder_name' => :'String',
    :'lock_content_control' => :'BOOLEAN',
    :'lock_contents' => :'BOOLEAN',
    :'is_showing_placeholder_text' => :'BOOLEAN',
    :'tag' => :'String',
    :'id' => :'Integer',
    :'word_open_xml' => :'String',
    :'level' => :'String',
    :'sdt_type' => :'String'
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
# File 'lib/aspose_words_cloud/models/structured_document_tag.rb', line 430

def ==(other)
  return true if self.equal?(other)
  self.class == other.class &&
      link == other.link &&
      node_id == other.node_id &&
      list_items == other.list_items &&
      checked == other.checked &&
      appearance == other.appearance &&
      date_display_locale == other.date_display_locale &&
      date_display_format == other.date_display_format &&
      full_date == other.full_date &&
      title == other.title &&
      date_storage_format == other.date_storage_format &&
      building_block_gallery == other.building_block_gallery &&
      building_block_category == other.building_block_category &&
      multiline == other.multiline &&
      color == other.color &&
      style_name == other.style_name &&
      calendar_type == other.calendar_type &&
      is_temporary == other.is_temporary &&
      placeholder_name == other.placeholder_name &&
      lock_content_control == other.lock_content_control &&
      lock_contents == other.lock_contents &&
      is_showing_placeholder_text == other.is_showing_placeholder_text &&
      tag == other.tag &&
      id == other.id &&
      word_open_xml == other.word_open_xml &&
      level == other.level &&
      sdt_type == other.sdt_type
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



498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
# File 'lib/aspose_words_cloud/models/structured_document_tag.rb', line 498

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    Time.at(/\d/.match(value)[0].to_f).to_datetime
  when :Date
    Time.at(/\d/.match(value)[0].to_f).to_date
  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
    if value[:'$type']
        type = value[:'$type'][0..-4]
    end

    temp_model = AsposeWordsCloud.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



569
570
571
572
573
574
575
576
577
578
579
580
581
# File 'lib/aspose_words_cloud/models/structured_document_tag.rb', line 569

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



476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
# File 'lib/aspose_words_cloud/models/structured_document_tag.rb', line 476

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

#collectFilesContent(resultFilesContent) ⇒ Object



583
584
# File 'lib/aspose_words_cloud/models/structured_document_tag.rb', line 583

def collectFilesContent(resultFilesContent)
end

#eql?(other) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


463
464
465
# File 'lib/aspose_words_cloud/models/structured_document_tag.rb', line 463

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



469
470
471
# File 'lib/aspose_words_cloud/models/structured_document_tag.rb', line 469

def hash
  [link, node_id, list_items, checked, appearance, date_display_locale, date_display_format, full_date, title, date_storage_format, building_block_gallery, building_block_category, multiline, color, style_name, calendar_type, is_temporary, placeholder_name, lock_content_control, lock_contents, is_showing_placeholder_text, tag, id, word_open_xml, level, sdt_type].hash
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



549
550
551
# File 'lib/aspose_words_cloud/models/structured_document_tag.rb', line 549

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



555
556
557
558
559
560
561
562
563
# File 'lib/aspose_words_cloud/models/structured_document_tag.rb', line 555

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



543
544
545
# File 'lib/aspose_words_cloud/models/structured_document_tag.rb', line 543

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



342
343
344
345
346
347
348
349
350
351
352
353
354
355
# File 'lib/aspose_words_cloud/models/structured_document_tag.rb', line 342

def valid?
  appearance_validator = EnumAttributeValidator.new('String', ["Default", "BoundingBox", "Tags", "Hidden"])
  return false unless appearance_validator.valid?(@appearance)
  date_storage_format_validator = EnumAttributeValidator.new('String', ["Date", "DateTime", "Default", "Text"])
  return false unless date_storage_format_validator.valid?(@date_storage_format)
  calendar_type_validator = EnumAttributeValidator.new('String', ["Default", "Gregorian", "GregorianArabic", "GregorianMeFrench", "GregorianUs", "GregorianXlitEnglish", "GregorianXlitFrench", "Hebrew", "Hijri", "Japan", "Korea", "None", "Saka", "Taiwan", "Thai"])
  return false unless calendar_type_validator.valid?(@calendar_type)
  level_validator = EnumAttributeValidator.new('String', ["Unknown", "Inline", "Block", "Row", "Cell"])
  return false unless level_validator.valid?(@level)
  sdt_type_validator = EnumAttributeValidator.new('String', ["None", "Bibliography", "Citation", "Equation", "DropDownList", "ComboBox", "Date", "BuildingBlockGallery", "DocPartObj", "Group", "Picture", "RichText", "PlainText", "Checkbox", "RepeatingSection", "RepeatingSectionItem", "EntityPicker"])
  return false unless sdt_type_validator.valid?(@sdt_type)

  return true
end

#validateObject



586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
# File 'lib/aspose_words_cloud/models/structured_document_tag.rb', line 586

def validate()
  unless self.link.nil?
      self.link.validate
  end
  unless self.list_items.nil?
      for elementListItems in self.list_items
          unless elementListItems.nil?
              elementListItems.validate
          end
      end
  end
  unless self.color.nil?
      self.color.validate
  end

end