Class: OpenXML::SpreadsheetML::Workbook
- Inherits:
-
Struct
- Object
- Struct
- OpenXML::SpreadsheetML::Workbook
- Defined in:
- lib/xlsx/workbook.rb,
lib/xlsx/workbook.rb
Instance Attribute Summary collapse
-
#calc_chain ⇒ Object
Returns the value of attribute calc_chain.
-
#sheets ⇒ Object
Returns the value of attribute sheets.
-
#styles ⇒ Object
Returns the value of attribute styles.
-
#theme ⇒ Object
Returns the value of attribute theme.
-
#xml_maps ⇒ Object
Returns the value of attribute xml_maps.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#calc_chain ⇒ Object
Returns the value of attribute calc_chain
3 4 5 |
# File 'lib/xlsx/workbook.rb', line 3 def calc_chain @calc_chain end |
#sheets ⇒ Object
Returns the value of attribute sheets
3 4 5 |
# File 'lib/xlsx/workbook.rb', line 3 def sheets @sheets end |
#styles ⇒ Object
Returns the value of attribute styles
3 4 5 |
# File 'lib/xlsx/workbook.rb', line 3 def styles @styles end |
#theme ⇒ Object
Returns the value of attribute theme
3 4 5 |
# File 'lib/xlsx/workbook.rb', line 3 def theme @theme end |
#xml_maps ⇒ Object
Returns the value of attribute xml_maps
3 4 5 |
# File 'lib/xlsx/workbook.rb', line 3 def xml_maps @xml_maps end |
Class Method Details
.parser(content) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/xlsx/workbook.rb', line 25 def self.parser content sheets = [] doc = Nokogiri::XML content = doc.css('sheet') .each do |s| sheet = Sheet.new sheet.name = s[:name] sheet.sheetId = s[:sheetId] sheet.rid = s['r:id'] sheets << sheet end Workbook.new(sheets = sheets) end |
Instance Method Details
#[](index) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/xlsx/workbook.rb', line 9 def [] index self.sheets.each do |sheet| return sheet if sheet.name == index end nil end |
#merge_sheets(sheets) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/xlsx/workbook.rb', line 16 def merge_sheets sheets new_sheets = [] self.sheets.zip(sheets) do |x, y| new_sheets << x + y end self.sheets = new_sheets self end |