Class: OoxmlParser::ExcelCommentCharacterProperties

Inherits:
OOXMLDocumentObject show all
Defined in:
lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/excel_comment/excel_comment_character/excel_comment_character_properties.rb

Constant Summary

Constants inherited from OOXMLDocumentObject

OOXMLDocumentObject::DEFAULT_DIRECTORY_FOR_MEDIA

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from OOXMLDocumentObject

#==, add_to_xmls_stack, copy_file_and_rename_to_zip, copy_media_file, current_xml, dir, encrypted_file?, get_link_from_rels, media_folder, option_enabled?, unzip_file

Constructor Details

#initialize(size = '', color = nil, font = '') ⇒ ExcelCommentCharacterProperties

Returns a new instance of ExcelCommentCharacterProperties.



6
7
8
9
10
# File 'lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/excel_comment/excel_comment_character/excel_comment_character_properties.rb', line 6

def initialize(size = '', color = nil, font = '')
  @size = size
  @color = color
  @font = font
end

Instance Attribute Details

#colorObject

Returns the value of attribute color.



4
5
6
# File 'lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/excel_comment/excel_comment_character/excel_comment_character_properties.rb', line 4

def color
  @color
end

#fontObject

Returns the value of attribute font.



4
5
6
# File 'lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/excel_comment/excel_comment_character/excel_comment_character_properties.rb', line 4

def font
  @font
end

#sizeObject

Returns the value of attribute size.



4
5
6
# File 'lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/excel_comment/excel_comment_character/excel_comment_character_properties.rb', line 4

def size
  @size
end

Class Method Details

.parse(properties_node) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/excel_comment/excel_comment_character/excel_comment_character_properties.rb', line 12

def self.parse(properties_node)
  character_properties = ExcelCommentCharacterProperties.new
  properties_node.xpath('*').each do |properties_node_child|
    case properties_node_child.name
    when 'sz'
      character_properties.size = properties_node_child.attribute('val').value
    when 'color'
      character_properties.color = Color.parse_color_tag(properties_node_child)
    when 'rFont'
      character_properties.font = properties_node_child.attribute('val').value
    end
  end
  character_properties
end