Created
November 20, 2009 15:11
-
-
Save thbar/239555 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'C:\Program Files\Open XML Format SDK\V2.0\\lib\DocumentFormat.OpenXml.dll' | |
include DocumentFormat::OpenXml::Packaging | |
include DocumentFormat::OpenXml::Spreadsheet | |
doc = SpreadsheetDocument.open('docs/single-cell.xlsx', false) | |
a = doc.workbook_part.workbook.method(:get_first_child).of(Sheets).call | |
puts a | |
# -> DocumentFormat.OpenXml.Spreadsheet.Sheets | |
b = a.method(:elements).of(Sheet).call | |
puts b | |
# -> DocumentFormat.OpenXml.OpenXmlElementList+<OfType>d__0`1[DocumentFormat.OpenXml.Spreadsheet.Sheet] | |
# b.first or anything similar fails | |
# b.methods shows a .to_a | |
puts b.to_a.first # woot! | |
# -> DocumentFormat.OpenXml.Spreadsheet.Sheet | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment