Class: OpenXml::Xlsx::Package
- Inherits:
-
Package
- Object
- Package
- OpenXml::Xlsx::Package
- Defined in:
- lib/openxml/xlsx/package.rb
Instance Attribute Summary collapse
-
#shared_strings ⇒ Object
readonly
Returns the value of attribute shared_strings.
-
#stylesheet ⇒ Object
readonly
Returns the value of attribute stylesheet.
-
#workbook ⇒ Object
readonly
Returns the value of attribute workbook.
-
#xl_rels ⇒ Object
readonly
Returns the value of attribute xl_rels.
Instance Method Summary collapse
-
#initialize ⇒ Package
constructor
A new instance of Package.
- #string_ref(string) ⇒ Object
- #style_ref(style) ⇒ Object
Constructor Details
#initialize ⇒ Package
Returns a new instance of Package.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# 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 |
Instance Attribute Details
#shared_strings ⇒ Object (readonly)
Returns the value of attribute shared_strings.
6 7 8 |
# File 'lib/openxml/xlsx/package.rb', line 6 def shared_strings @shared_strings end |
#stylesheet ⇒ Object (readonly)
Returns the value of attribute stylesheet.
6 7 8 |
# File 'lib/openxml/xlsx/package.rb', line 6 def stylesheet @stylesheet end |
#workbook ⇒ Object (readonly)
Returns the value of attribute workbook.
6 7 8 |
# File 'lib/openxml/xlsx/package.rb', line 6 def workbook @workbook end |
#xl_rels ⇒ Object (readonly)
Returns the value of attribute xl_rels.
6 7 8 |
# File 'lib/openxml/xlsx/package.rb', line 6 def xl_rels @xl_rels end |
Instance Method Details
#string_ref(string) ⇒ Object
42 43 44 |
# File 'lib/openxml/xlsx/package.rb', line 42 def string_ref(string) shared_strings.reference_of(string) end |
#style_ref(style) ⇒ Object
46 47 48 |
# File 'lib/openxml/xlsx/package.rb', line 46 def style_ref(style) stylesheet.reference_of(style) end |