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'

Constants inherited from OOXMLTopLevelObject

OOXMLTopLevelObject::ROOT, OOXMLTopLevelObject::SAVE_ORDER

Instance Attribute Summary collapse

Attributes inherited from OOXMLTopLevelObject

#root

Instance Method Summary collapse

Methods inherited from OOXMLTopLevelObject

#add_to_zip, #file_index, parse_file, set_namespaces

Methods included from OOXMLObjectInstanceMethods

#==, included, #index_in_collection, #initialize, #write_xml

Instance Attribute Details

#workbookObject

Returns the value of attribute workbook


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

def workbook
  @workbook
end

Instance Method Details

#before_write_xmlObject


57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/rubyXL/objects/document_properties.rb', line 57

def before_write_xml
  workbook = root.workbook

  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'))

  worksheets = chartsheets = 0

  workbook.worksheets.each { |sheet|
    add_part_title(sheet.sheet_name)

    case sheet
    when RubyXL::Worksheet  then worksheets += 1
    when RubyXL::Chartsheet then chartsheets += 1
    end
  }
  add_parts_count('Worksheets', worksheets) if worksheets > 0
  add_parts_count('Charts', chartsheets) if chartsheets > 0

  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

  true
end

#xlsx_pathObject


84
85
86
# File 'lib/rubyXL/objects/document_properties.rb', line 84

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