class OoxmlParser::DocumentStyle

Class for describing styles containing in styles.xml

Attributes

based_on[RW]

@return [FixNum] id of style on which this style is based

default[R]

@return [True, False] is style default

name[RW]

@return [String] name of style

next_style[RW]

@return [FixNum] id of next style

paragraph_properties[RW]

@return [DocxParagraph] run properties

q_format[RW]

@return [True, False] Latent Style Primary Style Setting Used to determine if current style is visible in style list in editors According to www.wordarticles.com/Articles/WordStyles/LatentStyles.php

run_properties[RW]

@return [DocxParagraphRun] run properties

style_id[RW]

@return [FixNum] number of style

table_cell_properties[RW]

@return [CellProperties] properties of table cell

table_properties[RW]

@return [TableProperties] properties of table

table_row_properties[RW]

@return [TableRowProperties] properties of table row

table_style_properties_list[RW]

@return [Array, TableStyleProperties] list of table style properties

type[RW]

@return [Symbol] Type of style (:paragraph or :table)

visible?[RW]

@return [True, False] Latent Style Primary Style Setting Used to determine if current style is visible in style list in editors According to www.wordarticles.com/Articles/WordStyles/LatentStyles.php

Public Class Methods

new(parent: nil) click to toggle source
Calls superclass method OoxmlParser::OOXMLDocumentObject::new
# File lib/ooxml_parser/docx_parser/docx_data/document_structure/document_style.rb, line 41
def initialize(parent: nil)
  @q_format = false
  @table_style_properties_list = []
  super
end

Public Instance Methods

inspect() click to toggle source

@return [String] inspect of object for debug means

# File lib/ooxml_parser/docx_parser/docx_data/document_structure/document_style.rb, line 53
def inspect
  to_s
end
parse(node) click to toggle source

Parse single document style @return [DocumentStyle]

# File lib/ooxml_parser/docx_parser/docx_data/document_structure/document_style.rb, line 59
def parse(node)
  node.attributes.each do |key, value|
    case key
    when 'type'
      @type = value.value.to_sym
    when 'styleId'
      @style_id = value.value
    when 'default'
      @default = attribute_enabled?(value.value)
    end
  end
  node.xpath('*').each do |subnode|
    case subnode.name
    when 'name'
      @name = subnode.attribute('val').value
    when 'basedOn'
      @based_on = subnode.attribute('val').value
    when 'next'
      @next_style = subnode.attribute('val').value
    when 'rPr'
      @run_properties = DocxParagraphRun.new(parent: self).parse_properties(subnode)
    when 'pPr'
      @paragraph_properties = ParagraphProperties.new(parent: self).parse(subnode)
    when 'tblPr'
      @table_properties = TableProperties.new(parent: self).parse(subnode)
    when 'trPr'
      @table_row_properties = TableRowProperties.new(parent: self).parse(subnode)
    when 'tcPr'
      @table_cell_properties = CellProperties.new(parent: self).parse(subnode)
    when 'tblStylePr'
      @table_style_properties_list << TableStyleProperties.new(parent: self).parse(subnode)
    when 'qFormat'
      @q_format = true
    end
  end
  fill_empty_table_styles
  self
end
to_s() click to toggle source

@return [String] result of convert of object to string

# File lib/ooxml_parser/docx_parser/docx_data/document_structure/document_style.rb, line 48
def to_s
  "Table style properties list: #{@table_style_properties_list.join(',')}"
end