Class: RubyXL::DocumentPropertiesFile

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

Overview

Constant Summary collapse

CONTENT_TYPE =
'application/vnd.openxmlformats-officedocument.extended-properties+xml'
REL_TYPE =
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties'

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from OOXMLTopLevelObject

#add_to_zip, #file_index, parse_file, save_order, 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.



11
12
13
# File 'lib/rubyXL/objects/document_properties.rb', line 11

def workbook
  @workbook
end

Instance Method Details

#add_part_title(name) ⇒ Object



51
52
53
# File 'lib/rubyXL/objects/document_properties.rb', line 51

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

#before_write_xmlObject



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

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_names then
      add_parts_count('Named Ranges', @workbook.defined_names.size)
      @workbook.defined_names.each { |defined_name| add_part_title(defined_name.name) }
    end
  end

  true
end

#xlsx_pathObject



73
74
75
# File 'lib/rubyXL/objects/document_properties.rb', line 73

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