Class: OoxmlParser::ParagraphStyle
- Inherits:
-
Object
- Object
- OoxmlParser::ParagraphStyle
- Defined in:
- lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/paragraph_style.rb
Instance Attribute Summary collapse
-
#background ⇒ Object
Returns the value of attribute background.
-
#borders ⇒ Object
Returns the value of attribute borders.
-
#font_name ⇒ Object
Returns the value of attribute font_name.
-
#font_size ⇒ Object
Returns the value of attribute font_size.
-
#font_style ⇒ Object
Returns the value of attribute font_style.
-
#indent ⇒ Object
Returns the value of attribute indent.
-
#name ⇒ Object
Returns the value of attribute name.
-
#spacing ⇒ Object
Returns the value of attribute spacing.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(style_name = nil, font_name = nil, font_size = nil, font_style = nil, spacing = nil, indent = nil, borders = nil, background = nil) ⇒ ParagraphStyle
constructor
A new instance of ParagraphStyle.
- #string_style_name ⇒ Object
Constructor Details
#initialize(style_name = nil, font_name = nil, font_size = nil, font_style = nil, spacing = nil, indent = nil, borders = nil, background = nil) ⇒ ParagraphStyle
Returns a new instance of ParagraphStyle.
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/paragraph_style.rb', line 16 def initialize(style_name = nil, font_name = nil, font_size = nil, font_style = nil, spacing = nil, indent = nil, borders = nil, background = nil) @name = style_name if style_name @font_name = font_name if font_name @font_size = font_size if font_size @font_style = font_style if font_style @spacing = spacing if spacing @indent = indent if indent @borders = borders if borders @background = background if background end |
Instance Attribute Details
#background ⇒ Object
Returns the value of attribute background.
7 8 9 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/paragraph_style.rb', line 7 def background @background end |
#borders ⇒ Object
Returns the value of attribute borders.
7 8 9 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/paragraph_style.rb', line 7 def borders @borders end |
#font_name ⇒ Object
Returns the value of attribute font_name.
7 8 9 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/paragraph_style.rb', line 7 def font_name @font_name end |
#font_size ⇒ Object
Returns the value of attribute font_size.
7 8 9 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/paragraph_style.rb', line 7 def font_size @font_size end |
#font_style ⇒ Object
Returns the value of attribute font_style.
7 8 9 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/paragraph_style.rb', line 7 def font_style @font_style end |
#indent ⇒ Object
Returns the value of attribute indent.
7 8 9 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/paragraph_style.rb', line 7 def indent @indent end |
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/paragraph_style.rb', line 7 def name @name end |
#spacing ⇒ Object
Returns the value of attribute spacing.
7 8 9 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/paragraph_style.rb', line 7 def spacing @spacing end |
Class Method Details
.init_by_name(style_name, object = :docx_paragraph) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/paragraph_style.rb', line 32 def self.init_by_name(style_name, object = :docx_paragraph) found_style = nil AllTestData.paragraph_settings::PARAGRAPH_STYLE_DATA.each do |style| found_style = style.clone if style.name == style_name end raise "Cannot find this style name - #{style_name}" if found_style.nil? case object when :table found_style.spacing = Spacing.new(found_style.spacing.before, 0, 1, found_style.spacing.line_rule) when :list found_style.indent = Indents.new(-0.635, 1.27, 0) end found_style end |
Instance Method Details
#==(other) ⇒ Object
50 51 52 53 54 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/paragraph_style.rb', line 50 def ==(other) # FIXME, correct border comparision @font_name == other.font_name && @font_size.to_f == other.font_size.to_f && @font_style == other.font_style && @spacing == other.spacing && @indent == other.indent && @background == other.background # && @border == other.border end |
#string_style_name ⇒ Object
28 29 30 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/paragraph_style.rb', line 28 def string_style_name @name.to_s.tr('_', ' ') end |