Class: RubyXL::DocumentProperties

Inherits:
OOXMLTopLevelObject show all
Defined in:
lib/rubyXL/objects/document_properties.rb

Overview

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from OOXMLTopLevelObject

#add_to_zip, #filepath, parse_file, set_namespaces

Methods included from OOXMLObjectClassMethods

#define_attribute, #define_child_node, #define_element_name, #obtain_class_variable, #parse, #set_countable

Methods included from OOXMLObjectInstanceMethods

#dup, #index_in_collection, #initialize, #write_xml

Instance Attribute Details

#workbookObject

Returns the value of attribute workbook.



8
9
10
# File 'lib/rubyXL/objects/document_properties.rb', line 8

def workbook
  @workbook
end

Class Method Details

.filepathObject



70
71
72
# File 'lib/rubyXL/objects/document_properties.rb', line 70

def self.filepath
  File.join('docProps', 'app.xml')
end

Instance Method Details

#add_part_title(name) ⇒ Object



48
49
50
# File 'lib/rubyXL/objects/document_properties.rb', line 48

def add_part_title(name)
  titles_of_parts.vt_vector.vt_lpstr << RubyXL::StringNode.new(:value => name)
end

#before_write_xmlObject



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/rubyXL/objects/document_properties.rb', line 53

def before_write_xml
  if @workbook then
    self.heading_pairs = RubyXL::VectorValue.new(:vt_vector => RubyXL::Vector.new(:base_type => 'variant'))
    self.titles_of_parts = RubyXL::VectorValue.new(:vt_vector => RubyXL::Vector.new(:base_type => 'lpstr'))

    add_parts_count('Worksheets', @workbook.worksheets.size)
    @workbook.worksheets.each { |sheet| add_part_title(sheet.sheet_name) }

    if @workbook.defined_name_container then
      add_parts_count('Named Ranges', @workbook.defined_name_container.defined_names.size)
      @workbook.defined_name_container.defined_names.each { |defined_name| add_part_title(defined_name.name) }
    end
  end

  true
end