Module: OoxmlParser::DocumentStyleHelper
- Included in:
- DocumentStructure, DocumentStyle
- Defined in:
- lib/ooxml_parser/docx_parser/document_structure/document_style/document_style_helper.rb
Overview
Helper methods for working with Style List
Instance Method Summary collapse
-
#based_on_style ⇒ DocumentStyle
Return document style which is based on.
-
#document_style_by_id(id) ⇒ DocumentStyle?
Return document style by its id.
-
#document_style_by_name(name) ⇒ DocumentStyle?
Return document style by its name.
-
#style_exist?(name) ⇒ True, False
Check if style exists in current document.
Instance Method Details
#based_on_style ⇒ DocumentStyle
Return document style which is based on
28 29 30 |
# File 'lib/ooxml_parser/docx_parser/document_structure/document_style/document_style_helper.rb', line 28 def based_on_style document_style_by_id(@based_on) end |
#document_style_by_id(id) ⇒ DocumentStyle?
Return document style by its id
19 20 21 22 23 24 |
# File 'lib/ooxml_parser/docx_parser/document_structure/document_style/document_style_helper.rb', line 19 def document_style_by_id(id) root_object.document_styles.each do |style| return style if style.style_id == id end nil end |
#document_style_by_name(name) ⇒ DocumentStyle?
Return document style by its name
9 10 11 12 13 14 |
# File 'lib/ooxml_parser/docx_parser/document_structure/document_style/document_style_helper.rb', line 9 def document_style_by_name(name) root_object.document_styles.each do |style| return style if style.name == name end nil end |
#style_exist?(name) ⇒ True, False
Check if style exists in current document
35 36 37 |
# File 'lib/ooxml_parser/docx_parser/document_structure/document_style/document_style_helper.rb', line 35 def style_exist?(name) !document_style_by_name(name).nil? end |