class OpenXml::Xlsx::Package

Attributes

shared_strings[R]
stylesheet[R]
workbook[R]
xl_rels[R]

Public Class Methods

new() click to toggle source
Calls superclass method
# File lib/openxml/xlsx/package.rb, line 20
def initialize
  super
  rels.add_relationship REL_DOCUMENT, "xl/workbook.xml"

  @xl_rels = OpenXml::Parts::Rels.new([
    { "Type" => REL_SHARED_STRINGS, "Target" => "sharedStrings.xml" },
    { "Type" => REL_STYLES, "Target" => "styles.xml" }
  ])
  @shared_strings = Xlsx::Parts::SharedStrings.new
  @stylesheet = Xlsx::Parts::Stylesheet.new
  @workbook = Xlsx::Parts::Workbook.new(self)

  # docProps/app.xml
  # docProps/core.xml
  add_part "xl/_rels/workbook.xml.rels", xl_rels
  # xl/calcChain.xml
  add_part "xl/sharedStrings.xml", shared_strings
  add_part "xl/styles.xml", stylesheet
  # xl/theme/theme1.xml
  add_part "xl/workbook.xml", workbook
end

Public Instance Methods

string_ref(string) click to toggle source
# File lib/openxml/xlsx/package.rb, line 42
def string_ref(string)
  shared_strings.reference_of(string)
end
style_ref(style) click to toggle source
# File lib/openxml/xlsx/package.rb, line 46
def style_ref(style)
  stylesheet.reference_of(style)
end