From 5b601a215009c607844cb3204ccfbf583e70fa5c Mon Sep 17 00:00:00 2001 From: Fabien LEFEBVRE Date: Thu, 21 Jul 2022 12:48:10 +0200 Subject: [PATCH] Bump version number to v1.0.2 --- README.md | 4 ++-- docs/404.html | 8 ++++---- docs/XlsxParser.html | 20 +++++++++++++------- docs/XlsxParser/Book.html | 26 +++++++++++++++++++++----- docs/XlsxParser/Sheet.html | 18 +++++++++++++----- docs/XlsxParser/Sheet/Type.html | 12 +++++++----- docs/XlsxParser/Styles.html | 20 +++++++++++++------- docs/XlsxParser/Styles/Converter.html | 14 +++++++++----- docs/XlsxParser/Styles/Parser.html | 14 +++++++++----- docs/index.html | 8 ++++---- docs/index.json | 2 +- docs/js/doc.js | 2 +- docs/search-index.js | 2 +- shard.yml | 2 +- src/xlsx-parser.cr | 2 +- 15 files changed, 100 insertions(+), 54 deletions(-) diff --git a/README.md b/README.md index 36f6c56..23c50b1 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# xlsx-parser (v1.0.1) +# xlsx-parser (v1.0.2) ![GitHub Workflow Status (event)](https://github.com/D1ceWard/xlsx-parser/actions/workflows/main.yml/badge.svg?branch=master) [![GitHub issues](https://img.shields.io/github/issues/D1ceWard/xlsx-parser)](https://github.com/D1ceWard/xlsx-parser/issues) [![GitHub license](https://img.shields.io/github/license/D1ceWard/xlsx-parser)](https://github.com/D1ceWard/xlsx-parser/blob/master/LICENSE) @@ -17,7 +17,7 @@ Note: Work with Cystal versions `>= 0.36.0, < 2.0.0` dependencies: xlsx-parser: github: D1ceWard/xlsx-parser - version: 1.0.1 + version: 1.0.2 ``` 2. Run `shards install` diff --git a/docs/404.html b/docs/404.html index 98983a7..ff50fc8 100644 --- a/docs/404.html +++ b/docs/404.html @@ -3,8 +3,8 @@ - - + + @@ -13,7 +13,7 @@ - xlsx-parser 1.0.1 + xlsx-parser 1.0.2 @@ -39,7 +39,7 @@

- 1.0.1 + 1.0.2 diff --git a/docs/XlsxParser.html b/docs/XlsxParser.html index d1605c4..4770262 100644 --- a/docs/XlsxParser.html +++ b/docs/XlsxParser.html @@ -3,8 +3,8 @@ - - + + @@ -13,7 +13,7 @@ - XlsxParser - xlsx-parser 1.0.1 + XlsxParser - xlsx-parser 1.0.2 @@ -39,7 +39,7 @@

- 1.0.1 + 1.0.2 @@ -141,17 +141,23 @@

- xlsx-parser.cr + + xlsx-parser.cr +
- xlsx-parser/book.cr + + xlsx-parser/book.cr +
- xlsx-parser/sheet.cr + + xlsx-parser/sheet.cr +
diff --git a/docs/XlsxParser/Book.html b/docs/XlsxParser/Book.html index 50b8870..41911dd 100644 --- a/docs/XlsxParser/Book.html +++ b/docs/XlsxParser/Book.html @@ -3,8 +3,8 @@ - - + + @@ -13,7 +13,7 @@ - XlsxParser::Book - xlsx-parser 1.0.1 + XlsxParser::Book - xlsx-parser 1.0.2 @@ -39,7 +39,7 @@

- 1.0.1 + 1.0.2 @@ -143,7 +143,9 @@

- xlsx-parser/book.cr + + xlsx-parser/book.cr +
@@ -301,6 +303,8 @@


+ [View source] +
@@ -335,6 +339,8 @@


+ [View source] +
@@ -354,6 +360,8 @@


+ [View source] +
@@ -368,6 +376,8 @@


+ [View source] +
@@ -387,6 +397,8 @@


+ [View source] +
@@ -401,6 +413,8 @@


+ [View source] +
@@ -415,6 +429,8 @@


+ [View source] +
diff --git a/docs/XlsxParser/Sheet.html b/docs/XlsxParser/Sheet.html index b62d697..6f587ef 100644 --- a/docs/XlsxParser/Sheet.html +++ b/docs/XlsxParser/Sheet.html @@ -3,8 +3,8 @@ - - + + @@ -13,7 +13,7 @@ - XlsxParser::Sheet - xlsx-parser 1.0.1 + XlsxParser::Sheet - xlsx-parser 1.0.2 @@ -39,7 +39,7 @@

- 1.0.1 + 1.0.2 @@ -143,7 +143,9 @@

- xlsx-parser/sheet.cr + + xlsx-parser/sheet.cr +
@@ -246,6 +248,8 @@


+ [View source] +
@@ -274,6 +278,8 @@


+ [View source] +
@@ -293,6 +299,8 @@


+ [View source] +
diff --git a/docs/XlsxParser/Sheet/Type.html b/docs/XlsxParser/Sheet/Type.html index 6bdddd6..da46c04 100644 --- a/docs/XlsxParser/Sheet/Type.html +++ b/docs/XlsxParser/Sheet/Type.html @@ -3,8 +3,8 @@ - - + + @@ -13,7 +13,7 @@ - XlsxParser::Sheet::Type - xlsx-parser 1.0.1 + XlsxParser::Sheet::Type - xlsx-parser 1.0.2 @@ -39,7 +39,7 @@

- 1.0.1 + 1.0.2 @@ -162,7 +162,9 @@

- xlsx-parser/sheet.cr + + xlsx-parser/sheet.cr +
diff --git a/docs/XlsxParser/Styles.html b/docs/XlsxParser/Styles.html index 6f95bb2..e463719 100644 --- a/docs/XlsxParser/Styles.html +++ b/docs/XlsxParser/Styles.html @@ -3,8 +3,8 @@ - - + + @@ -13,7 +13,7 @@ - XlsxParser::Styles - xlsx-parser 1.0.1 + XlsxParser::Styles - xlsx-parser 1.0.2 @@ -39,7 +39,7 @@

- 1.0.1 + 1.0.2 @@ -141,17 +141,23 @@

- xlsx-parser/styles.cr + + xlsx-parser/styles.cr +
- xlsx-parser/styles/converter.cr + + xlsx-parser/styles/converter.cr +
- xlsx-parser/styles/parser.cr + + xlsx-parser/styles/parser.cr +
diff --git a/docs/XlsxParser/Styles/Converter.html b/docs/XlsxParser/Styles/Converter.html index 88537b9..8811b07 100644 --- a/docs/XlsxParser/Styles/Converter.html +++ b/docs/XlsxParser/Styles/Converter.html @@ -3,8 +3,8 @@ - - + + @@ -13,7 +13,7 @@ - XlsxParser::Styles::Converter - xlsx-parser 1.0.1 + XlsxParser::Styles::Converter - xlsx-parser 1.0.2 @@ -39,7 +39,7 @@

- 1.0.1 + 1.0.2 @@ -143,7 +143,9 @@

- xlsx-parser/styles/converter.cr + + xlsx-parser/styles/converter.cr +
@@ -250,6 +252,8 @@


+ [View source] +
diff --git a/docs/XlsxParser/Styles/Parser.html b/docs/XlsxParser/Styles/Parser.html index 18fb9c1..90da378 100644 --- a/docs/XlsxParser/Styles/Parser.html +++ b/docs/XlsxParser/Styles/Parser.html @@ -3,8 +3,8 @@ - - + + @@ -13,7 +13,7 @@ - XlsxParser::Styles::Parser - xlsx-parser 1.0.1 + XlsxParser::Styles::Parser - xlsx-parser 1.0.2 @@ -39,7 +39,7 @@

- 1.0.1 + 1.0.2 @@ -143,7 +143,9 @@

- xlsx-parser/styles/parser.cr + + xlsx-parser/styles/parser.cr +
@@ -224,6 +226,8 @@


+ [View source] +
diff --git a/docs/index.html b/docs/index.html index 8214583..3168deb 100644 --- a/docs/index.html +++ b/docs/index.html @@ -3,8 +3,8 @@ - - + + @@ -13,7 +13,7 @@ - xlsx-parser 1.0.1 + xlsx-parser 1.0.2 @@ -39,7 +39,7 @@

- 1.0.1 + 1.0.2 diff --git a/docs/index.json b/docs/index.json index f935755..66d2eac 100644 --- a/docs/index.json +++ b/docs/index.json @@ -1 +1 @@ -{"repository_name":"xlsx-parser","body":"# xlsx-parser (v1.0.1)\n![GitHub Workflow Status (event)](https://github.com/D1ceWard/xlsx-parser/actions/workflows/main.yml/badge.svg?branch=master)\n[![GitHub issues](https://img.shields.io/github/issues/D1ceWard/xlsx-parser)](https://github.com/D1ceWard/xlsx-parser/issues)\n[![GitHub license](https://img.shields.io/github/license/D1ceWard/xlsx-parser)](https://github.com/D1ceWard/xlsx-parser/blob/master/LICENSE)\n\nCrystal wrapper for parsing .xlsx spreadsheets\n\n:rocket: Suggestions for new improvements are welcome in the issue tracker.\n\nNote: Work with Cystal versions `>= 0.36.0, < 2.0.0`\n\n## Installation\n\n1. Add the dependency to your `shard.yml`:\n\n ```yaml\n dependencies:\n xlsx-parser:\n github: D1ceWard/xlsx-parser\n version: 1.0.1\n ```\n\n2. Run `shards install`\n\n## Usage\n\n### With IO\n```crystal\nrequire \"xlsx-parser\"\n\nfile_io = File.new(\"./my_super_spreadsheet.xlsx\")\nbook = XlsxParser::Book.new(file_io)\n```\n\n### With file path\n```crystal\nrequire \"xlsx-parser\"\n\nbook = XlsxParser::Book.new(\"./my_super_spreadsheet.xlsx\")\n```\n\n### Print rows content\n```crystal\n# Iterate on each row of the first sheet\nbook.sheets[0].rows.each do |row|\n puts row #=> { \"A1\" => \"Col A Row 1\", \"B1\" => \"Col B Row 1\" }\nend\n\n# Second sheet\nbook.sheets[1]\n\nbook.close\n```\n\nDocumentation available here : https://d1ceward.github.io/xlsx-parser/\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/D1ceWard/xlsx-parser. By contributing you agree to abide by the Code of Merit.\n\n1. Fork it ()\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## Contributors\n\n- [D1ceWard](https://github.com/D1ceWard) - creator and maintainer\n","program":{"html_id":"xlsx-parser/toplevel","path":"toplevel.html","kind":"module","full_name":"Top Level Namespace","name":"Top Level Namespace","abstract":false,"locations":[],"repository_name":"xlsx-parser","program":true,"enum":false,"alias":false,"const":false,"types":[{"html_id":"xlsx-parser/XlsxParser","path":"XlsxParser.html","kind":"module","full_name":"XlsxParser","name":"XlsxParser","abstract":false,"locations":[{"filename":"src/xlsx-parser.cr","line_number":5,"url":null},{"filename":"src/xlsx-parser/book.cr","line_number":4,"url":null},{"filename":"src/xlsx-parser/sheet.cr","line_number":1,"url":null}],"repository_name":"xlsx-parser","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"VERSION","name":"VERSION","value":"\"1.0.1\""}],"types":[{"html_id":"xlsx-parser/XlsxParser/Book","path":"XlsxParser/Book.html","kind":"class","full_name":"XlsxParser::Book","name":"Book","abstract":false,"superclass":{"html_id":"xlsx-parser/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"xlsx-parser/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"xlsx-parser/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/xlsx-parser/book.cr","line_number":5,"url":null}],"repository_name":"xlsx-parser","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"TIME_1900","name":"TIME_1900","value":"Time.utc(1899, 12, 30)"},{"id":"TIME_1904","name":"TIME_1904","value":"Time.utc(1904, 1, 1)"}],"namespace":{"html_id":"xlsx-parser/XlsxParser","kind":"module","full_name":"XlsxParser","name":"XlsxParser"},"constructors":[{"html_id":"new(file:IO|String,check_file_extension=true)-class-method","name":"new","doc":"Open given file/filename and store shared strings data","summary":"

Open given file/filename and store shared strings data

","abstract":false,"args":[{"name":"file","external_name":"file","restriction":"IO | String"},{"name":"check_file_extension","default_value":"true","external_name":"check_file_extension","restriction":""}],"args_string":"(file : IO | String, check_file_extension = true)","args_html":"(file : IO | String, check_file_extension = true)","location":{"filename":"src/xlsx-parser/book.cr","line_number":16,"url":null},"def":{"name":"new","args":[{"name":"file","external_name":"file","restriction":"IO | String"},{"name":"check_file_extension","default_value":"true","external_name":"check_file_extension","restriction":""}],"visibility":"Public","body":"_ = allocate\n_.initialize(file, check_file_extension)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"base_time-instance-method","name":"base_time","doc":"Return and store base time given from workbookPr\nhttp://msdn.microsoft.com/en-us/library/ff530155(v=office.12).aspx","summary":"

Return and store base time given from workbookPr http://msdn.microsoft.com/en-us/library/ff530155(v=office.12).aspx

","abstract":false,"location":{"filename":"src/xlsx-parser/book.cr","line_number":63,"url":null},"def":{"name":"base_time","visibility":"Public","body":"@base_time || (@base_time = (begin\n result = TIME_1900\n workbook = XML.parse(@zip[\"xl/workbook.xml\"].open(&.gets_to_end))\n (workbook.xpath_nodes(\"//*[name()='workbookPr']\")).each do |workbook_pr|\n if workbook_pr.try do |__arg4|\n __arg4.attributes[\"date1904\"]\n end.try(&.content) =~ (/true|1/i)\n else\n next\n end\n result = TIME_1904\n break\n end\n result\nend))"}},{"html_id":"close-instance-method","name":"close","doc":"Close previously opened given file/filename","summary":"

Close previously opened given file/filename

","abstract":false,"location":{"filename":"src/xlsx-parser/book.cr","line_number":53,"url":null},"def":{"name":"close","visibility":"Public","body":"@zip.close"}},{"html_id":"shared_strings:Array(String)-instance-method","name":"shared_strings","abstract":false,"location":{"filename":"src/xlsx-parser/book.cr","line_number":8,"url":null},"def":{"name":"shared_strings","return_type":"Array(String)","visibility":"Public","body":"@shared_strings"}},{"html_id":"sheets-instance-method","name":"sheets","doc":"Return a array of sheets","summary":"

Return a array of sheets

","abstract":false,"location":{"filename":"src/xlsx-parser/book.cr","line_number":38,"url":null},"def":{"name":"sheets","visibility":"Public","body":"workbook = XML.parse(@zip[\"xl/workbook.xml\"].open(&.gets_to_end))\nsheets_nodes = workbook.xpath_nodes(\"//*[name()='sheet']\")\nrels = XML.parse(@zip[\"xl/_rels/workbook.xml.rels\"].open(&.gets_to_end))\n@sheets = sheets_nodes.map do |sheet|\n sheetfile = rels.xpath_string(\"string(//*[name()='Relationship' and contains(@Id,'#{sheet[\"id\"]}')]/@Target)\")\n Sheet.new(self, sheetfile)\nend\n"}},{"html_id":"style_types-instance-method","name":"style_types","abstract":false,"location":{"filename":"src/xlsx-parser/book.cr","line_number":57,"url":null},"def":{"name":"style_types","visibility":"Public","body":"@style_types || (@style_types = Styles::Parser.call(self))"}},{"html_id":"zip:Compress::Zip::File-instance-method","name":"zip","abstract":false,"location":{"filename":"src/xlsx-parser/book.cr","line_number":6,"url":null},"def":{"name":"zip","return_type":"Compress::Zip::File","visibility":"Public","body":"@zip"}}]},{"html_id":"xlsx-parser/XlsxParser/Sheet","path":"XlsxParser/Sheet.html","kind":"class","full_name":"XlsxParser::Sheet","name":"Sheet","abstract":false,"superclass":{"html_id":"xlsx-parser/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"xlsx-parser/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"xlsx-parser/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/xlsx-parser/sheet.cr","line_number":2,"url":null}],"repository_name":"xlsx-parser","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"xlsx-parser/XlsxParser","kind":"module","full_name":"XlsxParser","name":"XlsxParser"},"constructors":[{"html_id":"new(book:Book,file:String)-class-method","name":"new","abstract":false,"args":[{"name":"book","external_name":"book","restriction":"Book"},{"name":"file","external_name":"file","restriction":"String"}],"args_string":"(book : Book, file : String)","args_html":"(book : Book, file : String)","location":{"filename":"src/xlsx-parser/sheet.cr","line_number":8,"url":null},"def":{"name":"new","args":[{"name":"book","external_name":"book","restriction":"Book"},{"name":"file","external_name":"file","restriction":"String"}],"visibility":"Public","body":"_ = allocate\n_.initialize(book, file)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"node:XML::Reader-instance-method","name":"node","abstract":false,"location":{"filename":"src/xlsx-parser/sheet.cr","line_number":3,"url":null},"def":{"name":"node","return_type":"XML::Reader","visibility":"Public","body":"@node"}},{"html_id":"rows-instance-method","name":"rows","doc":"Return a iterator which return an hash per row that includes the cell ids and values","summary":"

Return a iterator which return an hash per row that includes the cell ids and values

","abstract":false,"location":{"filename":"src/xlsx-parser/sheet.cr","line_number":13,"url":null},"def":{"name":"rows","visibility":"Public","body":"Iterator.of do\n row = nil\n row_index = nil\n cell = nil\n cell_type = nil\n cell_style_idx = nil\n loop do\n if @node.read\n else\n break\n end\n if @node.name == \"row\"\n if @node.node_type == XML::Reader::Type::ELEMENT\n row = {} of String => Type\n row_index = node[\"r\"]?\n else\n row = inner_padding(row, row_index, cell)\n break\n end\n else\n if (@node.name == \"c\") && (@node.node_type == XML::Reader::Type::ELEMENT)\n cell_type = node[\"t\"]?\n cell_style_idx = node[\"s\"]?\n cell = node[\"r\"]?\n else\n if (((@node.name == \"v\") && (@node.node_type == XML::Reader::Type::ELEMENT)) && row) && cell\n row[cell] = convert(@node.read_inner_xml, cell_type, cell_style_idx)\n end\n end\n end\n end\n row || Iterator.stop\nend"}}],"types":[{"html_id":"xlsx-parser/XlsxParser/Sheet/Type","path":"XlsxParser/Sheet/Type.html","kind":"alias","full_name":"XlsxParser::Sheet::Type","name":"Type","abstract":false,"locations":[{"filename":"src/xlsx-parser/sheet.cr","line_number":6,"url":null}],"repository_name":"xlsx-parser","program":false,"enum":false,"alias":true,"aliased":"(Bool | Float64 | Int32 | String | Time)","aliased_html":"Bool | Float64 | Int32 | String | Time","const":false,"namespace":{"html_id":"xlsx-parser/XlsxParser/Sheet","kind":"class","full_name":"XlsxParser::Sheet","name":"Sheet"},"doc":"All possible output types","summary":"

All possible output types

"}]},{"html_id":"xlsx-parser/XlsxParser/Styles","path":"XlsxParser/Styles.html","kind":"module","full_name":"XlsxParser::Styles","name":"Styles","abstract":false,"locations":[{"filename":"src/xlsx-parser/styles.cr","line_number":4,"url":null},{"filename":"src/xlsx-parser/styles/converter.cr","line_number":1,"url":null},{"filename":"src/xlsx-parser/styles/parser.cr","line_number":1,"url":null}],"repository_name":"xlsx-parser","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"NumFmtMap","name":"NumFmtMap","value":"{0 => :string, 1 => :fixnum, 2 => :float, 3 => :fixnum, 4 => :float, 5 => :unsupported, 6 => :unsupported, 7 => :unsupported, 8 => :unsupported, 9 => :percentage, 10 => :percentage, 11 => :bignum, 12 => :unsupported, 13 => :unsupported, 14 => :date, 15 => :date, 16 => :date, 17 => :date, 18 => :time, 19 => :time, 20 => :time, 21 => :time, 22 => :date_time, 37 => :unsupported, 38 => :unsupported, 39 => :unsupported, 40 => :unsupported, 45 => :time, 46 => :time, 47 => :time, 48 => :bignum, 49 => :unsupported}","doc":"Map of non-custom numFmtId to casting symbol","summary":"

Map of non-custom numFmtId to casting symbol

"}],"namespace":{"html_id":"xlsx-parser/XlsxParser","kind":"module","full_name":"XlsxParser","name":"XlsxParser"},"types":[{"html_id":"xlsx-parser/XlsxParser/Styles/Converter","path":"XlsxParser/Styles/Converter.html","kind":"class","full_name":"XlsxParser::Styles::Converter","name":"Converter","abstract":false,"superclass":{"html_id":"xlsx-parser/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"xlsx-parser/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"xlsx-parser/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/xlsx-parser/styles/converter.cr","line_number":2,"url":null}],"repository_name":"xlsx-parser","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"DATE_TYPES","name":"DATE_TYPES","value":"[:date, :time, :date_time] of ::Symbol"}],"namespace":{"html_id":"xlsx-parser/XlsxParser/Styles","kind":"module","full_name":"XlsxParser::Styles","name":"Styles"},"class_methods":[{"html_id":"call(value:String,type:String?,style:Symbol?,book:Book)-class-method","name":"call","doc":"ameba:disable Metrics/CyclomaticComplexity","summary":"

ameba:disable Metrics/CyclomaticComplexity

","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"String"},{"name":"type","external_name":"type","restriction":"String | ::Nil"},{"name":"style","external_name":"style","restriction":"Symbol | ::Nil"},{"name":"book","external_name":"book","restriction":"Book"}],"args_string":"(value : String, type : String?, style : Symbol?, book : Book)","args_html":"(value : String, type : String?, style : Symbol?, book : Book)","location":{"filename":"src/xlsx-parser/styles/converter.cr","line_number":6,"url":null},"def":{"name":"call","args":[{"name":"value","external_name":"value","restriction":"String"},{"name":"type","external_name":"type","restriction":"String | ::Nil"},{"name":"style","external_name":"style","restriction":"Symbol | ::Nil"},{"name":"book","external_name":"book","restriction":"Book"}],"visibility":"Public","body":"if type.nil? || ((type == \"n\") && (DATE_TYPES.includes?(style)))\n type = style\nend\ncase type\nwhen \"s\"\n book.shared_strings[value.to_i]\nwhen \"n\"\n value.to_f\nwhen 'b'\n value.to_i == 1\nwhen :string\n value\nwhen :unsupported\n convert_unknown(value)\nwhen :fixnum\n value.to_i\nwhen :float, :percentage\n value.to_f\nwhen :time, :date, :date_time\n convert_time(value, book)\nelse\n convert_unknown(value)\nend\n"}}]},{"html_id":"xlsx-parser/XlsxParser/Styles/Parser","path":"XlsxParser/Styles/Parser.html","kind":"class","full_name":"XlsxParser::Styles::Parser","name":"Parser","abstract":false,"superclass":{"html_id":"xlsx-parser/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"xlsx-parser/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"xlsx-parser/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/xlsx-parser/styles/parser.cr","line_number":2,"url":null}],"repository_name":"xlsx-parser","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"xlsx-parser/XlsxParser/Styles","kind":"module","full_name":"XlsxParser::Styles","name":"Styles"},"class_methods":[{"html_id":"call(book:Book):Array(Symbol?)-class-method","name":"call","abstract":false,"args":[{"name":"book","external_name":"book","restriction":"Book"}],"args_string":"(book : Book) : Array(Symbol?)","args_html":"(book : Book) : Array(Symbol?)","location":{"filename":"src/xlsx-parser/styles/parser.cr","line_number":3,"url":null},"def":{"name":"call","args":[{"name":"book","external_name":"book","restriction":"Book"}],"return_type":"Array(Symbol | Nil)","visibility":"Public","body":"if (styles_file = book.zip[\"xl/styles.xml\"]?)\nelse\n return [] of Symbol | ::Nil\nend\nstyles = XML.parse(styles_file.open(&.gets_to_end))\ncustom_style_types = parse_custom_style_types(styles)\nstyles_nodes = styles.xpath_nodes(\"//*[name()='styleSheet']//*[name()='cellXfs']//*[name()='xf']\")\nstyles_nodes.map do |xstyle|\n if ( num_fmt_id = xstyle.attributes[\"numFmtId\"]?.try(&.content).try(&.to_i))\n else\n next\n end\n NumFmtMap[num_fmt_id]? || custom_style_types[num_fmt_id]\nend\n"}}]}]}]}]}} \ No newline at end of file +{"repository_name":"xlsx-parser","body":"# xlsx-parser (v1.0.1)\n![GitHub Workflow Status (event)](https://github.com/D1ceWard/xlsx-parser/actions/workflows/main.yml/badge.svg?branch=master)\n[![GitHub issues](https://img.shields.io/github/issues/D1ceWard/xlsx-parser)](https://github.com/D1ceWard/xlsx-parser/issues)\n[![GitHub license](https://img.shields.io/github/license/D1ceWard/xlsx-parser)](https://github.com/D1ceWard/xlsx-parser/blob/master/LICENSE)\n\nCrystal wrapper for parsing .xlsx spreadsheets\n\n:rocket: Suggestions for new improvements are welcome in the issue tracker.\n\nNote: Work with Cystal versions `>= 0.36.0, < 2.0.0`\n\n## Installation\n\n1. Add the dependency to your `shard.yml`:\n\n ```yaml\n dependencies:\n xlsx-parser:\n github: D1ceWard/xlsx-parser\n version: 1.0.1\n ```\n\n2. Run `shards install`\n\n## Usage\n\n### With IO\n```crystal\nrequire \"xlsx-parser\"\n\nfile_io = File.new(\"./my_super_spreadsheet.xlsx\")\nbook = XlsxParser::Book.new(file_io)\n```\n\n### With file path\n```crystal\nrequire \"xlsx-parser\"\n\nbook = XlsxParser::Book.new(\"./my_super_spreadsheet.xlsx\")\n```\n\n### Print rows content\n```crystal\n# Iterate on each row of the first sheet\nbook.sheets[0].rows.each do |row|\n puts row #=> { \"A1\" => \"Col A Row 1\", \"B1\" => \"Col B Row 1\" }\nend\n\n# Second sheet\nbook.sheets[1]\n\nbook.close\n```\n\nDocumentation available here : https://d1ceward.github.io/xlsx-parser/\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/D1ceWard/xlsx-parser. By contributing you agree to abide by the Code of Merit.\n\n1. Fork it ()\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## Contributors\n\n- [D1ceWard](https://github.com/D1ceWard) - creator and maintainer\n","program":{"html_id":"xlsx-parser/toplevel","path":"toplevel.html","kind":"module","full_name":"Top Level Namespace","name":"Top Level Namespace","abstract":false,"locations":[],"repository_name":"xlsx-parser","program":true,"enum":false,"alias":false,"const":false,"types":[{"html_id":"xlsx-parser/XlsxParser","path":"XlsxParser.html","kind":"module","full_name":"XlsxParser","name":"XlsxParser","abstract":false,"locations":[{"filename":"src/xlsx-parser.cr","line_number":5,"url":"https://github.com/D1ceWard/xlsx-parser/blob/af40bfbe992c5694e30eeadc6abd8803dc14a99d/src/xlsx-parser.cr#L5"},{"filename":"src/xlsx-parser/book.cr","line_number":4,"url":"https://github.com/D1ceWard/xlsx-parser/blob/af40bfbe992c5694e30eeadc6abd8803dc14a99d/src/xlsx-parser/book.cr#L4"},{"filename":"src/xlsx-parser/sheet.cr","line_number":1,"url":"https://github.com/D1ceWard/xlsx-parser/blob/af40bfbe992c5694e30eeadc6abd8803dc14a99d/src/xlsx-parser/sheet.cr#L1"}],"repository_name":"xlsx-parser","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"VERSION","name":"VERSION","value":"\"1.0.1\""}],"types":[{"html_id":"xlsx-parser/XlsxParser/Book","path":"XlsxParser/Book.html","kind":"class","full_name":"XlsxParser::Book","name":"Book","abstract":false,"superclass":{"html_id":"xlsx-parser/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"xlsx-parser/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"xlsx-parser/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/xlsx-parser/book.cr","line_number":5,"url":"https://github.com/D1ceWard/xlsx-parser/blob/af40bfbe992c5694e30eeadc6abd8803dc14a99d/src/xlsx-parser/book.cr#L5"}],"repository_name":"xlsx-parser","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"TIME_1900","name":"TIME_1900","value":"Time.utc(1899, 12, 30)"},{"id":"TIME_1904","name":"TIME_1904","value":"Time.utc(1904, 1, 1)"}],"namespace":{"html_id":"xlsx-parser/XlsxParser","kind":"module","full_name":"XlsxParser","name":"XlsxParser"},"constructors":[{"html_id":"new(file:IO|String,check_file_extension=true)-class-method","name":"new","doc":"Open given file/filename and store shared strings data","summary":"

Open given file/filename and store shared strings data

","abstract":false,"args":[{"name":"file","external_name":"file","restriction":"IO | String"},{"name":"check_file_extension","default_value":"true","external_name":"check_file_extension","restriction":""}],"args_string":"(file : IO | String, check_file_extension = true)","args_html":"(file : IO | String, check_file_extension = true)","location":{"filename":"src/xlsx-parser/book.cr","line_number":16,"url":"https://github.com/D1ceWard/xlsx-parser/blob/af40bfbe992c5694e30eeadc6abd8803dc14a99d/src/xlsx-parser/book.cr#L16"},"def":{"name":"new","args":[{"name":"file","external_name":"file","restriction":"IO | String"},{"name":"check_file_extension","default_value":"true","external_name":"check_file_extension","restriction":""}],"visibility":"Public","body":"_ = allocate\n_.initialize(file, check_file_extension)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"base_time-instance-method","name":"base_time","doc":"Return and store base time given from workbookPr\nhttp://msdn.microsoft.com/en-us/library/ff530155(v=office.12).aspx","summary":"

Return and store base time given from workbookPr http://msdn.microsoft.com/en-us/library/ff530155(v=office.12).aspx

","abstract":false,"location":{"filename":"src/xlsx-parser/book.cr","line_number":63,"url":"https://github.com/D1ceWard/xlsx-parser/blob/af40bfbe992c5694e30eeadc6abd8803dc14a99d/src/xlsx-parser/book.cr#L63"},"def":{"name":"base_time","visibility":"Public","body":"@base_time || (@base_time = (begin\n result = TIME_1900\n workbook = XML.parse(@zip[\"xl/workbook.xml\"].open(&.gets_to_end))\n (workbook.xpath_nodes(\"//*[name()='workbookPr']\")).each do |workbook_pr|\n if workbook_pr.try do |__arg4|\n __arg4.attributes[\"date1904\"]?\n end.try(&.content) =~ (/true|1/i)\n else\n next\n end\n result = TIME_1904\n break\n end\n result\nend))"}},{"html_id":"close-instance-method","name":"close","doc":"Close previously opened given file/filename","summary":"

Close previously opened given file/filename

","abstract":false,"location":{"filename":"src/xlsx-parser/book.cr","line_number":53,"url":"https://github.com/D1ceWard/xlsx-parser/blob/af40bfbe992c5694e30eeadc6abd8803dc14a99d/src/xlsx-parser/book.cr#L53"},"def":{"name":"close","visibility":"Public","body":"@zip.close"}},{"html_id":"shared_strings:Array(String)-instance-method","name":"shared_strings","abstract":false,"location":{"filename":"src/xlsx-parser/book.cr","line_number":8,"url":"https://github.com/D1ceWard/xlsx-parser/blob/af40bfbe992c5694e30eeadc6abd8803dc14a99d/src/xlsx-parser/book.cr#L8"},"def":{"name":"shared_strings","return_type":"Array(String)","visibility":"Public","body":"@shared_strings"}},{"html_id":"sheets-instance-method","name":"sheets","doc":"Return a array of sheets","summary":"

Return a array of sheets

","abstract":false,"location":{"filename":"src/xlsx-parser/book.cr","line_number":38,"url":"https://github.com/D1ceWard/xlsx-parser/blob/af40bfbe992c5694e30eeadc6abd8803dc14a99d/src/xlsx-parser/book.cr#L38"},"def":{"name":"sheets","visibility":"Public","body":"workbook = XML.parse(@zip[\"xl/workbook.xml\"].open(&.gets_to_end))\nsheets_nodes = workbook.xpath_nodes(\"//*[name()='sheet']\")\nrels = XML.parse(@zip[\"xl/_rels/workbook.xml.rels\"].open(&.gets_to_end))\n@sheets = sheets_nodes.map do |sheet|\n sheetfile = rels.xpath_string(\"string(//*[name()='Relationship' and contains(@Id,'#{sheet[\"id\"]}')]/@Target)\")\n Sheet.new(self, sheetfile)\nend\n"}},{"html_id":"style_types-instance-method","name":"style_types","abstract":false,"location":{"filename":"src/xlsx-parser/book.cr","line_number":57,"url":"https://github.com/D1ceWard/xlsx-parser/blob/af40bfbe992c5694e30eeadc6abd8803dc14a99d/src/xlsx-parser/book.cr#L57"},"def":{"name":"style_types","visibility":"Public","body":"@style_types || (@style_types = Styles::Parser.call(self))"}},{"html_id":"zip:Compress::Zip::File-instance-method","name":"zip","abstract":false,"location":{"filename":"src/xlsx-parser/book.cr","line_number":6,"url":"https://github.com/D1ceWard/xlsx-parser/blob/af40bfbe992c5694e30eeadc6abd8803dc14a99d/src/xlsx-parser/book.cr#L6"},"def":{"name":"zip","return_type":"Compress::Zip::File","visibility":"Public","body":"@zip"}}]},{"html_id":"xlsx-parser/XlsxParser/Sheet","path":"XlsxParser/Sheet.html","kind":"class","full_name":"XlsxParser::Sheet","name":"Sheet","abstract":false,"superclass":{"html_id":"xlsx-parser/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"xlsx-parser/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"xlsx-parser/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/xlsx-parser/sheet.cr","line_number":2,"url":"https://github.com/D1ceWard/xlsx-parser/blob/af40bfbe992c5694e30eeadc6abd8803dc14a99d/src/xlsx-parser/sheet.cr#L2"}],"repository_name":"xlsx-parser","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"xlsx-parser/XlsxParser","kind":"module","full_name":"XlsxParser","name":"XlsxParser"},"constructors":[{"html_id":"new(book:Book,file:String)-class-method","name":"new","abstract":false,"args":[{"name":"book","external_name":"book","restriction":"Book"},{"name":"file","external_name":"file","restriction":"String"}],"args_string":"(book : Book, file : String)","args_html":"(book : Book, file : String)","location":{"filename":"src/xlsx-parser/sheet.cr","line_number":8,"url":"https://github.com/D1ceWard/xlsx-parser/blob/af40bfbe992c5694e30eeadc6abd8803dc14a99d/src/xlsx-parser/sheet.cr#L8"},"def":{"name":"new","args":[{"name":"book","external_name":"book","restriction":"Book"},{"name":"file","external_name":"file","restriction":"String"}],"visibility":"Public","body":"_ = allocate\n_.initialize(book, file)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"node:XML::Reader-instance-method","name":"node","abstract":false,"location":{"filename":"src/xlsx-parser/sheet.cr","line_number":3,"url":"https://github.com/D1ceWard/xlsx-parser/blob/af40bfbe992c5694e30eeadc6abd8803dc14a99d/src/xlsx-parser/sheet.cr#L3"},"def":{"name":"node","return_type":"XML::Reader","visibility":"Public","body":"@node"}},{"html_id":"rows-instance-method","name":"rows","doc":"Return a iterator which return an hash per row that includes the cell ids and values","summary":"

Return a iterator which return an hash per row that includes the cell ids and values

","abstract":false,"location":{"filename":"src/xlsx-parser/sheet.cr","line_number":13,"url":"https://github.com/D1ceWard/xlsx-parser/blob/af40bfbe992c5694e30eeadc6abd8803dc14a99d/src/xlsx-parser/sheet.cr#L13"},"def":{"name":"rows","visibility":"Public","body":"Iterator.of do\n row = nil\n row_index = nil\n cell = nil\n cell_type = nil\n cell_style_idx = nil\n loop do\n if @node.read\n else\n break\n end\n if @node.name == \"row\"\n if @node.node_type == XML::Reader::Type::ELEMENT\n row = {} of String => Type\n row_index = node[\"r\"]?\n else\n row = inner_padding(row, row_index, cell)\n break\n end\n else\n if (@node.name == \"c\") && (@node.node_type == XML::Reader::Type::ELEMENT)\n cell_type = node[\"t\"]?\n cell_style_idx = node[\"s\"]?\n cell = node[\"r\"]?\n else\n if (((@node.name == \"v\") && (@node.node_type == XML::Reader::Type::ELEMENT)) && row) && cell\n row[cell] = convert(@node.read_inner_xml, cell_type, cell_style_idx)\n end\n end\n end\n end\n row || Iterator.stop\nend"}}],"types":[{"html_id":"xlsx-parser/XlsxParser/Sheet/Type","path":"XlsxParser/Sheet/Type.html","kind":"alias","full_name":"XlsxParser::Sheet::Type","name":"Type","abstract":false,"locations":[{"filename":"src/xlsx-parser/sheet.cr","line_number":6,"url":"https://github.com/D1ceWard/xlsx-parser/blob/af40bfbe992c5694e30eeadc6abd8803dc14a99d/src/xlsx-parser/sheet.cr#L6"}],"repository_name":"xlsx-parser","program":false,"enum":false,"alias":true,"aliased":"(Bool | Float64 | Int32 | String | Time)","aliased_html":"Bool | Float64 | Int32 | String | Time","const":false,"namespace":{"html_id":"xlsx-parser/XlsxParser/Sheet","kind":"class","full_name":"XlsxParser::Sheet","name":"Sheet"},"doc":"All possible output types","summary":"

All possible output types

"}]},{"html_id":"xlsx-parser/XlsxParser/Styles","path":"XlsxParser/Styles.html","kind":"module","full_name":"XlsxParser::Styles","name":"Styles","abstract":false,"locations":[{"filename":"src/xlsx-parser/styles.cr","line_number":4,"url":"https://github.com/D1ceWard/xlsx-parser/blob/af40bfbe992c5694e30eeadc6abd8803dc14a99d/src/xlsx-parser/styles.cr#L4"},{"filename":"src/xlsx-parser/styles/converter.cr","line_number":1,"url":"https://github.com/D1ceWard/xlsx-parser/blob/af40bfbe992c5694e30eeadc6abd8803dc14a99d/src/xlsx-parser/styles/converter.cr#L1"},{"filename":"src/xlsx-parser/styles/parser.cr","line_number":1,"url":"https://github.com/D1ceWard/xlsx-parser/blob/af40bfbe992c5694e30eeadc6abd8803dc14a99d/src/xlsx-parser/styles/parser.cr#L1"}],"repository_name":"xlsx-parser","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"NumFmtMap","name":"NumFmtMap","value":"{0 => :string, 1 => :fixnum, 2 => :float, 3 => :fixnum, 4 => :float, 5 => :unsupported, 6 => :unsupported, 7 => :unsupported, 8 => :unsupported, 9 => :percentage, 10 => :percentage, 11 => :bignum, 12 => :unsupported, 13 => :unsupported, 14 => :date, 15 => :date, 16 => :date, 17 => :date, 18 => :time, 19 => :time, 20 => :time, 21 => :time, 22 => :date_time, 37 => :unsupported, 38 => :unsupported, 39 => :unsupported, 40 => :unsupported, 45 => :time, 46 => :time, 47 => :time, 48 => :bignum, 49 => :unsupported}","doc":"Map of non-custom numFmtId to casting symbol","summary":"

Map of non-custom numFmtId to casting symbol

"}],"namespace":{"html_id":"xlsx-parser/XlsxParser","kind":"module","full_name":"XlsxParser","name":"XlsxParser"},"types":[{"html_id":"xlsx-parser/XlsxParser/Styles/Converter","path":"XlsxParser/Styles/Converter.html","kind":"class","full_name":"XlsxParser::Styles::Converter","name":"Converter","abstract":false,"superclass":{"html_id":"xlsx-parser/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"xlsx-parser/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"xlsx-parser/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/xlsx-parser/styles/converter.cr","line_number":2,"url":"https://github.com/D1ceWard/xlsx-parser/blob/af40bfbe992c5694e30eeadc6abd8803dc14a99d/src/xlsx-parser/styles/converter.cr#L2"}],"repository_name":"xlsx-parser","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"DATE_TYPES","name":"DATE_TYPES","value":"[:date, :time, :date_time] of ::Symbol"}],"namespace":{"html_id":"xlsx-parser/XlsxParser/Styles","kind":"module","full_name":"XlsxParser::Styles","name":"Styles"},"class_methods":[{"html_id":"call(value:String,type:String?,style:Symbol?,book:Book)-class-method","name":"call","doc":"ameba:disable Metrics/CyclomaticComplexity","summary":"

ameba:disable Metrics/CyclomaticComplexity

","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"String"},{"name":"type","external_name":"type","restriction":"String | ::Nil"},{"name":"style","external_name":"style","restriction":"Symbol | ::Nil"},{"name":"book","external_name":"book","restriction":"Book"}],"args_string":"(value : String, type : String?, style : Symbol?, book : Book)","args_html":"(value : String, type : String?, style : Symbol?, book : Book)","location":{"filename":"src/xlsx-parser/styles/converter.cr","line_number":6,"url":"https://github.com/D1ceWard/xlsx-parser/blob/af40bfbe992c5694e30eeadc6abd8803dc14a99d/src/xlsx-parser/styles/converter.cr#L6"},"def":{"name":"call","args":[{"name":"value","external_name":"value","restriction":"String"},{"name":"type","external_name":"type","restriction":"String | ::Nil"},{"name":"style","external_name":"style","restriction":"Symbol | ::Nil"},{"name":"book","external_name":"book","restriction":"Book"}],"visibility":"Public","body":"if type.nil? || ((type == \"n\") && (DATE_TYPES.includes?(style)))\n type = style\nend\ncase type\nwhen \"s\"\n book.shared_strings[value.to_i]\nwhen \"n\"\n value.to_f\nwhen 'b'\n value.to_i == 1\nwhen :string\n value\nwhen :unsupported\n convert_unknown(value)\nwhen :fixnum\n value.to_i\nwhen :float, :percentage\n value.to_f\nwhen :time, :date, :date_time\n convert_time(value, book)\nelse\n convert_unknown(value)\nend\n"}}]},{"html_id":"xlsx-parser/XlsxParser/Styles/Parser","path":"XlsxParser/Styles/Parser.html","kind":"class","full_name":"XlsxParser::Styles::Parser","name":"Parser","abstract":false,"superclass":{"html_id":"xlsx-parser/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"xlsx-parser/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"xlsx-parser/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/xlsx-parser/styles/parser.cr","line_number":2,"url":"https://github.com/D1ceWard/xlsx-parser/blob/af40bfbe992c5694e30eeadc6abd8803dc14a99d/src/xlsx-parser/styles/parser.cr#L2"}],"repository_name":"xlsx-parser","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"xlsx-parser/XlsxParser/Styles","kind":"module","full_name":"XlsxParser::Styles","name":"Styles"},"class_methods":[{"html_id":"call(book:Book):Array(Symbol?)-class-method","name":"call","abstract":false,"args":[{"name":"book","external_name":"book","restriction":"Book"}],"args_string":"(book : Book) : Array(Symbol?)","args_html":"(book : Book) : Array(Symbol?)","location":{"filename":"src/xlsx-parser/styles/parser.cr","line_number":3,"url":"https://github.com/D1ceWard/xlsx-parser/blob/af40bfbe992c5694e30eeadc6abd8803dc14a99d/src/xlsx-parser/styles/parser.cr#L3"},"def":{"name":"call","args":[{"name":"book","external_name":"book","restriction":"Book"}],"return_type":"Array(Symbol | Nil)","visibility":"Public","body":"if (styles_file = book.zip[\"xl/styles.xml\"]?)\nelse\n return [] of Symbol | ::Nil\nend\nstyles = XML.parse(styles_file.open(&.gets_to_end))\ncustom_style_types = parse_custom_style_types(styles)\nstyles_nodes = styles.xpath_nodes(\"//*[name()='styleSheet']//*[name()='cellXfs']//*[name()='xf']\")\nstyles_nodes.map do |xstyle|\n if ( num_fmt_id = xstyle.attributes[\"numFmtId\"]?.try(&.content).try(&.to_i))\n else\n next\n end\n NumFmtMap[num_fmt_id]? || custom_style_types[num_fmt_id]\nend\n"}}]}]}]}]}} \ No newline at end of file diff --git a/docs/js/doc.js b/docs/js/doc.js index 703ad28..c322bd8 100644 --- a/docs/js/doc.js +++ b/docs/js/doc.js @@ -607,7 +607,7 @@ Navigator = function(sidebar, searchInput, list, leaveSearchScope){ var go = function() { if (!self.moveTimeout) return; self.move(upwards); - self.moveTimout = setTimeout(go, 600); + self.moveTimeout = setTimeout(go, 600); }; self.moveTimeout = setTimeout(go, 800);*/ } diff --git a/docs/search-index.js b/docs/search-index.js index 863f887..6470031 100644 --- a/docs/search-index.js +++ b/docs/search-index.js @@ -1 +1 @@ -crystal_doc_search_index_callback({"repository_name":"xlsx-parser","body":"# xlsx-parser (v1.0.1)\n![GitHub Workflow Status (event)](https://github.com/D1ceWard/xlsx-parser/actions/workflows/main.yml/badge.svg?branch=master)\n[![GitHub issues](https://img.shields.io/github/issues/D1ceWard/xlsx-parser)](https://github.com/D1ceWard/xlsx-parser/issues)\n[![GitHub license](https://img.shields.io/github/license/D1ceWard/xlsx-parser)](https://github.com/D1ceWard/xlsx-parser/blob/master/LICENSE)\n\nCrystal wrapper for parsing .xlsx spreadsheets\n\n:rocket: Suggestions for new improvements are welcome in the issue tracker.\n\nNote: Work with Cystal versions `>= 0.36.0, < 2.0.0`\n\n## Installation\n\n1. Add the dependency to your `shard.yml`:\n\n ```yaml\n dependencies:\n xlsx-parser:\n github: D1ceWard/xlsx-parser\n version: 1.0.1\n ```\n\n2. Run `shards install`\n\n## Usage\n\n### With IO\n```crystal\nrequire \"xlsx-parser\"\n\nfile_io = File.new(\"./my_super_spreadsheet.xlsx\")\nbook = XlsxParser::Book.new(file_io)\n```\n\n### With file path\n```crystal\nrequire \"xlsx-parser\"\n\nbook = XlsxParser::Book.new(\"./my_super_spreadsheet.xlsx\")\n```\n\n### Print rows content\n```crystal\n# Iterate on each row of the first sheet\nbook.sheets[0].rows.each do |row|\n puts row #=> { \"A1\" => \"Col A Row 1\", \"B1\" => \"Col B Row 1\" }\nend\n\n# Second sheet\nbook.sheets[1]\n\nbook.close\n```\n\nDocumentation available here : https://d1ceward.github.io/xlsx-parser/\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/D1ceWard/xlsx-parser. By contributing you agree to abide by the Code of Merit.\n\n1. Fork it ()\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## Contributors\n\n- [D1ceWard](https://github.com/D1ceWard) - creator and maintainer\n","program":{"html_id":"xlsx-parser/toplevel","path":"toplevel.html","kind":"module","full_name":"Top Level Namespace","name":"Top Level Namespace","abstract":false,"locations":[],"repository_name":"xlsx-parser","program":true,"enum":false,"alias":false,"const":false,"types":[{"html_id":"xlsx-parser/XlsxParser","path":"XlsxParser.html","kind":"module","full_name":"XlsxParser","name":"XlsxParser","abstract":false,"locations":[{"filename":"src/xlsx-parser.cr","line_number":5,"url":null},{"filename":"src/xlsx-parser/book.cr","line_number":4,"url":null},{"filename":"src/xlsx-parser/sheet.cr","line_number":1,"url":null}],"repository_name":"xlsx-parser","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"VERSION","name":"VERSION","value":"\"1.0.1\""}],"types":[{"html_id":"xlsx-parser/XlsxParser/Book","path":"XlsxParser/Book.html","kind":"class","full_name":"XlsxParser::Book","name":"Book","abstract":false,"superclass":{"html_id":"xlsx-parser/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"xlsx-parser/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"xlsx-parser/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/xlsx-parser/book.cr","line_number":5,"url":null}],"repository_name":"xlsx-parser","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"TIME_1900","name":"TIME_1900","value":"Time.utc(1899, 12, 30)"},{"id":"TIME_1904","name":"TIME_1904","value":"Time.utc(1904, 1, 1)"}],"namespace":{"html_id":"xlsx-parser/XlsxParser","kind":"module","full_name":"XlsxParser","name":"XlsxParser"},"constructors":[{"html_id":"new(file:IO|String,check_file_extension=true)-class-method","name":"new","doc":"Open given file/filename and store shared strings data","summary":"

Open given file/filename and store shared strings data

","abstract":false,"args":[{"name":"file","external_name":"file","restriction":"IO | String"},{"name":"check_file_extension","default_value":"true","external_name":"check_file_extension","restriction":""}],"args_string":"(file : IO | String, check_file_extension = true)","args_html":"(file : IO | String, check_file_extension = true)","location":{"filename":"src/xlsx-parser/book.cr","line_number":16,"url":null},"def":{"name":"new","args":[{"name":"file","external_name":"file","restriction":"IO | String"},{"name":"check_file_extension","default_value":"true","external_name":"check_file_extension","restriction":""}],"visibility":"Public","body":"_ = allocate\n_.initialize(file, check_file_extension)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"base_time-instance-method","name":"base_time","doc":"Return and store base time given from workbookPr\nhttp://msdn.microsoft.com/en-us/library/ff530155(v=office.12).aspx","summary":"

Return and store base time given from workbookPr http://msdn.microsoft.com/en-us/library/ff530155(v=office.12).aspx

","abstract":false,"location":{"filename":"src/xlsx-parser/book.cr","line_number":63,"url":null},"def":{"name":"base_time","visibility":"Public","body":"@base_time || (@base_time = (begin\n result = TIME_1900\n workbook = XML.parse(@zip[\"xl/workbook.xml\"].open(&.gets_to_end))\n (workbook.xpath_nodes(\"//*[name()='workbookPr']\")).each do |workbook_pr|\n if workbook_pr.try do |__arg4|\n __arg4.attributes[\"date1904\"]\n end.try(&.content) =~ (/true|1/i)\n else\n next\n end\n result = TIME_1904\n break\n end\n result\nend))"}},{"html_id":"close-instance-method","name":"close","doc":"Close previously opened given file/filename","summary":"

Close previously opened given file/filename

","abstract":false,"location":{"filename":"src/xlsx-parser/book.cr","line_number":53,"url":null},"def":{"name":"close","visibility":"Public","body":"@zip.close"}},{"html_id":"shared_strings:Array(String)-instance-method","name":"shared_strings","abstract":false,"location":{"filename":"src/xlsx-parser/book.cr","line_number":8,"url":null},"def":{"name":"shared_strings","return_type":"Array(String)","visibility":"Public","body":"@shared_strings"}},{"html_id":"sheets-instance-method","name":"sheets","doc":"Return a array of sheets","summary":"

Return a array of sheets

","abstract":false,"location":{"filename":"src/xlsx-parser/book.cr","line_number":38,"url":null},"def":{"name":"sheets","visibility":"Public","body":"workbook = XML.parse(@zip[\"xl/workbook.xml\"].open(&.gets_to_end))\nsheets_nodes = workbook.xpath_nodes(\"//*[name()='sheet']\")\nrels = XML.parse(@zip[\"xl/_rels/workbook.xml.rels\"].open(&.gets_to_end))\n@sheets = sheets_nodes.map do |sheet|\n sheetfile = rels.xpath_string(\"string(//*[name()='Relationship' and contains(@Id,'#{sheet[\"id\"]}')]/@Target)\")\n Sheet.new(self, sheetfile)\nend\n"}},{"html_id":"style_types-instance-method","name":"style_types","abstract":false,"location":{"filename":"src/xlsx-parser/book.cr","line_number":57,"url":null},"def":{"name":"style_types","visibility":"Public","body":"@style_types || (@style_types = Styles::Parser.call(self))"}},{"html_id":"zip:Compress::Zip::File-instance-method","name":"zip","abstract":false,"location":{"filename":"src/xlsx-parser/book.cr","line_number":6,"url":null},"def":{"name":"zip","return_type":"Compress::Zip::File","visibility":"Public","body":"@zip"}}]},{"html_id":"xlsx-parser/XlsxParser/Sheet","path":"XlsxParser/Sheet.html","kind":"class","full_name":"XlsxParser::Sheet","name":"Sheet","abstract":false,"superclass":{"html_id":"xlsx-parser/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"xlsx-parser/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"xlsx-parser/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/xlsx-parser/sheet.cr","line_number":2,"url":null}],"repository_name":"xlsx-parser","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"xlsx-parser/XlsxParser","kind":"module","full_name":"XlsxParser","name":"XlsxParser"},"constructors":[{"html_id":"new(book:Book,file:String)-class-method","name":"new","abstract":false,"args":[{"name":"book","external_name":"book","restriction":"Book"},{"name":"file","external_name":"file","restriction":"String"}],"args_string":"(book : Book, file : String)","args_html":"(book : Book, file : String)","location":{"filename":"src/xlsx-parser/sheet.cr","line_number":8,"url":null},"def":{"name":"new","args":[{"name":"book","external_name":"book","restriction":"Book"},{"name":"file","external_name":"file","restriction":"String"}],"visibility":"Public","body":"_ = allocate\n_.initialize(book, file)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"node:XML::Reader-instance-method","name":"node","abstract":false,"location":{"filename":"src/xlsx-parser/sheet.cr","line_number":3,"url":null},"def":{"name":"node","return_type":"XML::Reader","visibility":"Public","body":"@node"}},{"html_id":"rows-instance-method","name":"rows","doc":"Return a iterator which return an hash per row that includes the cell ids and values","summary":"

Return a iterator which return an hash per row that includes the cell ids and values

","abstract":false,"location":{"filename":"src/xlsx-parser/sheet.cr","line_number":13,"url":null},"def":{"name":"rows","visibility":"Public","body":"Iterator.of do\n row = nil\n row_index = nil\n cell = nil\n cell_type = nil\n cell_style_idx = nil\n loop do\n if @node.read\n else\n break\n end\n if @node.name == \"row\"\n if @node.node_type == XML::Reader::Type::ELEMENT\n row = {} of String => Type\n row_index = node[\"r\"]?\n else\n row = inner_padding(row, row_index, cell)\n break\n end\n else\n if (@node.name == \"c\") && (@node.node_type == XML::Reader::Type::ELEMENT)\n cell_type = node[\"t\"]?\n cell_style_idx = node[\"s\"]?\n cell = node[\"r\"]?\n else\n if (((@node.name == \"v\") && (@node.node_type == XML::Reader::Type::ELEMENT)) && row) && cell\n row[cell] = convert(@node.read_inner_xml, cell_type, cell_style_idx)\n end\n end\n end\n end\n row || Iterator.stop\nend"}}],"types":[{"html_id":"xlsx-parser/XlsxParser/Sheet/Type","path":"XlsxParser/Sheet/Type.html","kind":"alias","full_name":"XlsxParser::Sheet::Type","name":"Type","abstract":false,"locations":[{"filename":"src/xlsx-parser/sheet.cr","line_number":6,"url":null}],"repository_name":"xlsx-parser","program":false,"enum":false,"alias":true,"aliased":"(Bool | Float64 | Int32 | String | Time)","aliased_html":"Bool | Float64 | Int32 | String | Time","const":false,"namespace":{"html_id":"xlsx-parser/XlsxParser/Sheet","kind":"class","full_name":"XlsxParser::Sheet","name":"Sheet"},"doc":"All possible output types","summary":"

All possible output types

"}]},{"html_id":"xlsx-parser/XlsxParser/Styles","path":"XlsxParser/Styles.html","kind":"module","full_name":"XlsxParser::Styles","name":"Styles","abstract":false,"locations":[{"filename":"src/xlsx-parser/styles.cr","line_number":4,"url":null},{"filename":"src/xlsx-parser/styles/converter.cr","line_number":1,"url":null},{"filename":"src/xlsx-parser/styles/parser.cr","line_number":1,"url":null}],"repository_name":"xlsx-parser","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"NumFmtMap","name":"NumFmtMap","value":"{0 => :string, 1 => :fixnum, 2 => :float, 3 => :fixnum, 4 => :float, 5 => :unsupported, 6 => :unsupported, 7 => :unsupported, 8 => :unsupported, 9 => :percentage, 10 => :percentage, 11 => :bignum, 12 => :unsupported, 13 => :unsupported, 14 => :date, 15 => :date, 16 => :date, 17 => :date, 18 => :time, 19 => :time, 20 => :time, 21 => :time, 22 => :date_time, 37 => :unsupported, 38 => :unsupported, 39 => :unsupported, 40 => :unsupported, 45 => :time, 46 => :time, 47 => :time, 48 => :bignum, 49 => :unsupported}","doc":"Map of non-custom numFmtId to casting symbol","summary":"

Map of non-custom numFmtId to casting symbol

"}],"namespace":{"html_id":"xlsx-parser/XlsxParser","kind":"module","full_name":"XlsxParser","name":"XlsxParser"},"types":[{"html_id":"xlsx-parser/XlsxParser/Styles/Converter","path":"XlsxParser/Styles/Converter.html","kind":"class","full_name":"XlsxParser::Styles::Converter","name":"Converter","abstract":false,"superclass":{"html_id":"xlsx-parser/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"xlsx-parser/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"xlsx-parser/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/xlsx-parser/styles/converter.cr","line_number":2,"url":null}],"repository_name":"xlsx-parser","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"DATE_TYPES","name":"DATE_TYPES","value":"[:date, :time, :date_time] of ::Symbol"}],"namespace":{"html_id":"xlsx-parser/XlsxParser/Styles","kind":"module","full_name":"XlsxParser::Styles","name":"Styles"},"class_methods":[{"html_id":"call(value:String,type:String?,style:Symbol?,book:Book)-class-method","name":"call","doc":"ameba:disable Metrics/CyclomaticComplexity","summary":"

ameba:disable Metrics/CyclomaticComplexity

","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"String"},{"name":"type","external_name":"type","restriction":"String | ::Nil"},{"name":"style","external_name":"style","restriction":"Symbol | ::Nil"},{"name":"book","external_name":"book","restriction":"Book"}],"args_string":"(value : String, type : String?, style : Symbol?, book : Book)","args_html":"(value : String, type : String?, style : Symbol?, book : Book)","location":{"filename":"src/xlsx-parser/styles/converter.cr","line_number":6,"url":null},"def":{"name":"call","args":[{"name":"value","external_name":"value","restriction":"String"},{"name":"type","external_name":"type","restriction":"String | ::Nil"},{"name":"style","external_name":"style","restriction":"Symbol | ::Nil"},{"name":"book","external_name":"book","restriction":"Book"}],"visibility":"Public","body":"if type.nil? || ((type == \"n\") && (DATE_TYPES.includes?(style)))\n type = style\nend\ncase type\nwhen \"s\"\n book.shared_strings[value.to_i]\nwhen \"n\"\n value.to_f\nwhen 'b'\n value.to_i == 1\nwhen :string\n value\nwhen :unsupported\n convert_unknown(value)\nwhen :fixnum\n value.to_i\nwhen :float, :percentage\n value.to_f\nwhen :time, :date, :date_time\n convert_time(value, book)\nelse\n convert_unknown(value)\nend\n"}}]},{"html_id":"xlsx-parser/XlsxParser/Styles/Parser","path":"XlsxParser/Styles/Parser.html","kind":"class","full_name":"XlsxParser::Styles::Parser","name":"Parser","abstract":false,"superclass":{"html_id":"xlsx-parser/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"xlsx-parser/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"xlsx-parser/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/xlsx-parser/styles/parser.cr","line_number":2,"url":null}],"repository_name":"xlsx-parser","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"xlsx-parser/XlsxParser/Styles","kind":"module","full_name":"XlsxParser::Styles","name":"Styles"},"class_methods":[{"html_id":"call(book:Book):Array(Symbol?)-class-method","name":"call","abstract":false,"args":[{"name":"book","external_name":"book","restriction":"Book"}],"args_string":"(book : Book) : Array(Symbol?)","args_html":"(book : Book) : Array(Symbol?)","location":{"filename":"src/xlsx-parser/styles/parser.cr","line_number":3,"url":null},"def":{"name":"call","args":[{"name":"book","external_name":"book","restriction":"Book"}],"return_type":"Array(Symbol | Nil)","visibility":"Public","body":"if (styles_file = book.zip[\"xl/styles.xml\"]?)\nelse\n return [] of Symbol | ::Nil\nend\nstyles = XML.parse(styles_file.open(&.gets_to_end))\ncustom_style_types = parse_custom_style_types(styles)\nstyles_nodes = styles.xpath_nodes(\"//*[name()='styleSheet']//*[name()='cellXfs']//*[name()='xf']\")\nstyles_nodes.map do |xstyle|\n if ( num_fmt_id = xstyle.attributes[\"numFmtId\"]?.try(&.content).try(&.to_i))\n else\n next\n end\n NumFmtMap[num_fmt_id]? || custom_style_types[num_fmt_id]\nend\n"}}]}]}]}]}}) \ No newline at end of file +crystal_doc_search_index_callback({"repository_name":"xlsx-parser","body":"# xlsx-parser (v1.0.1)\n![GitHub Workflow Status (event)](https://github.com/D1ceWard/xlsx-parser/actions/workflows/main.yml/badge.svg?branch=master)\n[![GitHub issues](https://img.shields.io/github/issues/D1ceWard/xlsx-parser)](https://github.com/D1ceWard/xlsx-parser/issues)\n[![GitHub license](https://img.shields.io/github/license/D1ceWard/xlsx-parser)](https://github.com/D1ceWard/xlsx-parser/blob/master/LICENSE)\n\nCrystal wrapper for parsing .xlsx spreadsheets\n\n:rocket: Suggestions for new improvements are welcome in the issue tracker.\n\nNote: Work with Cystal versions `>= 0.36.0, < 2.0.0`\n\n## Installation\n\n1. Add the dependency to your `shard.yml`:\n\n ```yaml\n dependencies:\n xlsx-parser:\n github: D1ceWard/xlsx-parser\n version: 1.0.1\n ```\n\n2. Run `shards install`\n\n## Usage\n\n### With IO\n```crystal\nrequire \"xlsx-parser\"\n\nfile_io = File.new(\"./my_super_spreadsheet.xlsx\")\nbook = XlsxParser::Book.new(file_io)\n```\n\n### With file path\n```crystal\nrequire \"xlsx-parser\"\n\nbook = XlsxParser::Book.new(\"./my_super_spreadsheet.xlsx\")\n```\n\n### Print rows content\n```crystal\n# Iterate on each row of the first sheet\nbook.sheets[0].rows.each do |row|\n puts row #=> { \"A1\" => \"Col A Row 1\", \"B1\" => \"Col B Row 1\" }\nend\n\n# Second sheet\nbook.sheets[1]\n\nbook.close\n```\n\nDocumentation available here : https://d1ceward.github.io/xlsx-parser/\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/D1ceWard/xlsx-parser. By contributing you agree to abide by the Code of Merit.\n\n1. Fork it ()\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## Contributors\n\n- [D1ceWard](https://github.com/D1ceWard) - creator and maintainer\n","program":{"html_id":"xlsx-parser/toplevel","path":"toplevel.html","kind":"module","full_name":"Top Level Namespace","name":"Top Level Namespace","abstract":false,"locations":[],"repository_name":"xlsx-parser","program":true,"enum":false,"alias":false,"const":false,"types":[{"html_id":"xlsx-parser/XlsxParser","path":"XlsxParser.html","kind":"module","full_name":"XlsxParser","name":"XlsxParser","abstract":false,"locations":[{"filename":"src/xlsx-parser.cr","line_number":5,"url":"https://github.com/D1ceWard/xlsx-parser/blob/af40bfbe992c5694e30eeadc6abd8803dc14a99d/src/xlsx-parser.cr#L5"},{"filename":"src/xlsx-parser/book.cr","line_number":4,"url":"https://github.com/D1ceWard/xlsx-parser/blob/af40bfbe992c5694e30eeadc6abd8803dc14a99d/src/xlsx-parser/book.cr#L4"},{"filename":"src/xlsx-parser/sheet.cr","line_number":1,"url":"https://github.com/D1ceWard/xlsx-parser/blob/af40bfbe992c5694e30eeadc6abd8803dc14a99d/src/xlsx-parser/sheet.cr#L1"}],"repository_name":"xlsx-parser","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"VERSION","name":"VERSION","value":"\"1.0.1\""}],"types":[{"html_id":"xlsx-parser/XlsxParser/Book","path":"XlsxParser/Book.html","kind":"class","full_name":"XlsxParser::Book","name":"Book","abstract":false,"superclass":{"html_id":"xlsx-parser/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"xlsx-parser/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"xlsx-parser/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/xlsx-parser/book.cr","line_number":5,"url":"https://github.com/D1ceWard/xlsx-parser/blob/af40bfbe992c5694e30eeadc6abd8803dc14a99d/src/xlsx-parser/book.cr#L5"}],"repository_name":"xlsx-parser","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"TIME_1900","name":"TIME_1900","value":"Time.utc(1899, 12, 30)"},{"id":"TIME_1904","name":"TIME_1904","value":"Time.utc(1904, 1, 1)"}],"namespace":{"html_id":"xlsx-parser/XlsxParser","kind":"module","full_name":"XlsxParser","name":"XlsxParser"},"constructors":[{"html_id":"new(file:IO|String,check_file_extension=true)-class-method","name":"new","doc":"Open given file/filename and store shared strings data","summary":"

Open given file/filename and store shared strings data

","abstract":false,"args":[{"name":"file","external_name":"file","restriction":"IO | String"},{"name":"check_file_extension","default_value":"true","external_name":"check_file_extension","restriction":""}],"args_string":"(file : IO | String, check_file_extension = true)","args_html":"(file : IO | String, check_file_extension = true)","location":{"filename":"src/xlsx-parser/book.cr","line_number":16,"url":"https://github.com/D1ceWard/xlsx-parser/blob/af40bfbe992c5694e30eeadc6abd8803dc14a99d/src/xlsx-parser/book.cr#L16"},"def":{"name":"new","args":[{"name":"file","external_name":"file","restriction":"IO | String"},{"name":"check_file_extension","default_value":"true","external_name":"check_file_extension","restriction":""}],"visibility":"Public","body":"_ = allocate\n_.initialize(file, check_file_extension)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"base_time-instance-method","name":"base_time","doc":"Return and store base time given from workbookPr\nhttp://msdn.microsoft.com/en-us/library/ff530155(v=office.12).aspx","summary":"

Return and store base time given from workbookPr http://msdn.microsoft.com/en-us/library/ff530155(v=office.12).aspx

","abstract":false,"location":{"filename":"src/xlsx-parser/book.cr","line_number":63,"url":"https://github.com/D1ceWard/xlsx-parser/blob/af40bfbe992c5694e30eeadc6abd8803dc14a99d/src/xlsx-parser/book.cr#L63"},"def":{"name":"base_time","visibility":"Public","body":"@base_time || (@base_time = (begin\n result = TIME_1900\n workbook = XML.parse(@zip[\"xl/workbook.xml\"].open(&.gets_to_end))\n (workbook.xpath_nodes(\"//*[name()='workbookPr']\")).each do |workbook_pr|\n if workbook_pr.try do |__arg4|\n __arg4.attributes[\"date1904\"]?\n end.try(&.content) =~ (/true|1/i)\n else\n next\n end\n result = TIME_1904\n break\n end\n result\nend))"}},{"html_id":"close-instance-method","name":"close","doc":"Close previously opened given file/filename","summary":"

Close previously opened given file/filename

","abstract":false,"location":{"filename":"src/xlsx-parser/book.cr","line_number":53,"url":"https://github.com/D1ceWard/xlsx-parser/blob/af40bfbe992c5694e30eeadc6abd8803dc14a99d/src/xlsx-parser/book.cr#L53"},"def":{"name":"close","visibility":"Public","body":"@zip.close"}},{"html_id":"shared_strings:Array(String)-instance-method","name":"shared_strings","abstract":false,"location":{"filename":"src/xlsx-parser/book.cr","line_number":8,"url":"https://github.com/D1ceWard/xlsx-parser/blob/af40bfbe992c5694e30eeadc6abd8803dc14a99d/src/xlsx-parser/book.cr#L8"},"def":{"name":"shared_strings","return_type":"Array(String)","visibility":"Public","body":"@shared_strings"}},{"html_id":"sheets-instance-method","name":"sheets","doc":"Return a array of sheets","summary":"

Return a array of sheets

","abstract":false,"location":{"filename":"src/xlsx-parser/book.cr","line_number":38,"url":"https://github.com/D1ceWard/xlsx-parser/blob/af40bfbe992c5694e30eeadc6abd8803dc14a99d/src/xlsx-parser/book.cr#L38"},"def":{"name":"sheets","visibility":"Public","body":"workbook = XML.parse(@zip[\"xl/workbook.xml\"].open(&.gets_to_end))\nsheets_nodes = workbook.xpath_nodes(\"//*[name()='sheet']\")\nrels = XML.parse(@zip[\"xl/_rels/workbook.xml.rels\"].open(&.gets_to_end))\n@sheets = sheets_nodes.map do |sheet|\n sheetfile = rels.xpath_string(\"string(//*[name()='Relationship' and contains(@Id,'#{sheet[\"id\"]}')]/@Target)\")\n Sheet.new(self, sheetfile)\nend\n"}},{"html_id":"style_types-instance-method","name":"style_types","abstract":false,"location":{"filename":"src/xlsx-parser/book.cr","line_number":57,"url":"https://github.com/D1ceWard/xlsx-parser/blob/af40bfbe992c5694e30eeadc6abd8803dc14a99d/src/xlsx-parser/book.cr#L57"},"def":{"name":"style_types","visibility":"Public","body":"@style_types || (@style_types = Styles::Parser.call(self))"}},{"html_id":"zip:Compress::Zip::File-instance-method","name":"zip","abstract":false,"location":{"filename":"src/xlsx-parser/book.cr","line_number":6,"url":"https://github.com/D1ceWard/xlsx-parser/blob/af40bfbe992c5694e30eeadc6abd8803dc14a99d/src/xlsx-parser/book.cr#L6"},"def":{"name":"zip","return_type":"Compress::Zip::File","visibility":"Public","body":"@zip"}}]},{"html_id":"xlsx-parser/XlsxParser/Sheet","path":"XlsxParser/Sheet.html","kind":"class","full_name":"XlsxParser::Sheet","name":"Sheet","abstract":false,"superclass":{"html_id":"xlsx-parser/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"xlsx-parser/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"xlsx-parser/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/xlsx-parser/sheet.cr","line_number":2,"url":"https://github.com/D1ceWard/xlsx-parser/blob/af40bfbe992c5694e30eeadc6abd8803dc14a99d/src/xlsx-parser/sheet.cr#L2"}],"repository_name":"xlsx-parser","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"xlsx-parser/XlsxParser","kind":"module","full_name":"XlsxParser","name":"XlsxParser"},"constructors":[{"html_id":"new(book:Book,file:String)-class-method","name":"new","abstract":false,"args":[{"name":"book","external_name":"book","restriction":"Book"},{"name":"file","external_name":"file","restriction":"String"}],"args_string":"(book : Book, file : String)","args_html":"(book : Book, file : String)","location":{"filename":"src/xlsx-parser/sheet.cr","line_number":8,"url":"https://github.com/D1ceWard/xlsx-parser/blob/af40bfbe992c5694e30eeadc6abd8803dc14a99d/src/xlsx-parser/sheet.cr#L8"},"def":{"name":"new","args":[{"name":"book","external_name":"book","restriction":"Book"},{"name":"file","external_name":"file","restriction":"String"}],"visibility":"Public","body":"_ = allocate\n_.initialize(book, file)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"node:XML::Reader-instance-method","name":"node","abstract":false,"location":{"filename":"src/xlsx-parser/sheet.cr","line_number":3,"url":"https://github.com/D1ceWard/xlsx-parser/blob/af40bfbe992c5694e30eeadc6abd8803dc14a99d/src/xlsx-parser/sheet.cr#L3"},"def":{"name":"node","return_type":"XML::Reader","visibility":"Public","body":"@node"}},{"html_id":"rows-instance-method","name":"rows","doc":"Return a iterator which return an hash per row that includes the cell ids and values","summary":"

Return a iterator which return an hash per row that includes the cell ids and values

","abstract":false,"location":{"filename":"src/xlsx-parser/sheet.cr","line_number":13,"url":"https://github.com/D1ceWard/xlsx-parser/blob/af40bfbe992c5694e30eeadc6abd8803dc14a99d/src/xlsx-parser/sheet.cr#L13"},"def":{"name":"rows","visibility":"Public","body":"Iterator.of do\n row = nil\n row_index = nil\n cell = nil\n cell_type = nil\n cell_style_idx = nil\n loop do\n if @node.read\n else\n break\n end\n if @node.name == \"row\"\n if @node.node_type == XML::Reader::Type::ELEMENT\n row = {} of String => Type\n row_index = node[\"r\"]?\n else\n row = inner_padding(row, row_index, cell)\n break\n end\n else\n if (@node.name == \"c\") && (@node.node_type == XML::Reader::Type::ELEMENT)\n cell_type = node[\"t\"]?\n cell_style_idx = node[\"s\"]?\n cell = node[\"r\"]?\n else\n if (((@node.name == \"v\") && (@node.node_type == XML::Reader::Type::ELEMENT)) && row) && cell\n row[cell] = convert(@node.read_inner_xml, cell_type, cell_style_idx)\n end\n end\n end\n end\n row || Iterator.stop\nend"}}],"types":[{"html_id":"xlsx-parser/XlsxParser/Sheet/Type","path":"XlsxParser/Sheet/Type.html","kind":"alias","full_name":"XlsxParser::Sheet::Type","name":"Type","abstract":false,"locations":[{"filename":"src/xlsx-parser/sheet.cr","line_number":6,"url":"https://github.com/D1ceWard/xlsx-parser/blob/af40bfbe992c5694e30eeadc6abd8803dc14a99d/src/xlsx-parser/sheet.cr#L6"}],"repository_name":"xlsx-parser","program":false,"enum":false,"alias":true,"aliased":"(Bool | Float64 | Int32 | String | Time)","aliased_html":"Bool | Float64 | Int32 | String | Time","const":false,"namespace":{"html_id":"xlsx-parser/XlsxParser/Sheet","kind":"class","full_name":"XlsxParser::Sheet","name":"Sheet"},"doc":"All possible output types","summary":"

All possible output types

"}]},{"html_id":"xlsx-parser/XlsxParser/Styles","path":"XlsxParser/Styles.html","kind":"module","full_name":"XlsxParser::Styles","name":"Styles","abstract":false,"locations":[{"filename":"src/xlsx-parser/styles.cr","line_number":4,"url":"https://github.com/D1ceWard/xlsx-parser/blob/af40bfbe992c5694e30eeadc6abd8803dc14a99d/src/xlsx-parser/styles.cr#L4"},{"filename":"src/xlsx-parser/styles/converter.cr","line_number":1,"url":"https://github.com/D1ceWard/xlsx-parser/blob/af40bfbe992c5694e30eeadc6abd8803dc14a99d/src/xlsx-parser/styles/converter.cr#L1"},{"filename":"src/xlsx-parser/styles/parser.cr","line_number":1,"url":"https://github.com/D1ceWard/xlsx-parser/blob/af40bfbe992c5694e30eeadc6abd8803dc14a99d/src/xlsx-parser/styles/parser.cr#L1"}],"repository_name":"xlsx-parser","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"NumFmtMap","name":"NumFmtMap","value":"{0 => :string, 1 => :fixnum, 2 => :float, 3 => :fixnum, 4 => :float, 5 => :unsupported, 6 => :unsupported, 7 => :unsupported, 8 => :unsupported, 9 => :percentage, 10 => :percentage, 11 => :bignum, 12 => :unsupported, 13 => :unsupported, 14 => :date, 15 => :date, 16 => :date, 17 => :date, 18 => :time, 19 => :time, 20 => :time, 21 => :time, 22 => :date_time, 37 => :unsupported, 38 => :unsupported, 39 => :unsupported, 40 => :unsupported, 45 => :time, 46 => :time, 47 => :time, 48 => :bignum, 49 => :unsupported}","doc":"Map of non-custom numFmtId to casting symbol","summary":"

Map of non-custom numFmtId to casting symbol

"}],"namespace":{"html_id":"xlsx-parser/XlsxParser","kind":"module","full_name":"XlsxParser","name":"XlsxParser"},"types":[{"html_id":"xlsx-parser/XlsxParser/Styles/Converter","path":"XlsxParser/Styles/Converter.html","kind":"class","full_name":"XlsxParser::Styles::Converter","name":"Converter","abstract":false,"superclass":{"html_id":"xlsx-parser/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"xlsx-parser/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"xlsx-parser/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/xlsx-parser/styles/converter.cr","line_number":2,"url":"https://github.com/D1ceWard/xlsx-parser/blob/af40bfbe992c5694e30eeadc6abd8803dc14a99d/src/xlsx-parser/styles/converter.cr#L2"}],"repository_name":"xlsx-parser","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"DATE_TYPES","name":"DATE_TYPES","value":"[:date, :time, :date_time] of ::Symbol"}],"namespace":{"html_id":"xlsx-parser/XlsxParser/Styles","kind":"module","full_name":"XlsxParser::Styles","name":"Styles"},"class_methods":[{"html_id":"call(value:String,type:String?,style:Symbol?,book:Book)-class-method","name":"call","doc":"ameba:disable Metrics/CyclomaticComplexity","summary":"

ameba:disable Metrics/CyclomaticComplexity

","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"String"},{"name":"type","external_name":"type","restriction":"String | ::Nil"},{"name":"style","external_name":"style","restriction":"Symbol | ::Nil"},{"name":"book","external_name":"book","restriction":"Book"}],"args_string":"(value : String, type : String?, style : Symbol?, book : Book)","args_html":"(value : String, type : String?, style : Symbol?, book : Book)","location":{"filename":"src/xlsx-parser/styles/converter.cr","line_number":6,"url":"https://github.com/D1ceWard/xlsx-parser/blob/af40bfbe992c5694e30eeadc6abd8803dc14a99d/src/xlsx-parser/styles/converter.cr#L6"},"def":{"name":"call","args":[{"name":"value","external_name":"value","restriction":"String"},{"name":"type","external_name":"type","restriction":"String | ::Nil"},{"name":"style","external_name":"style","restriction":"Symbol | ::Nil"},{"name":"book","external_name":"book","restriction":"Book"}],"visibility":"Public","body":"if type.nil? || ((type == \"n\") && (DATE_TYPES.includes?(style)))\n type = style\nend\ncase type\nwhen \"s\"\n book.shared_strings[value.to_i]\nwhen \"n\"\n value.to_f\nwhen 'b'\n value.to_i == 1\nwhen :string\n value\nwhen :unsupported\n convert_unknown(value)\nwhen :fixnum\n value.to_i\nwhen :float, :percentage\n value.to_f\nwhen :time, :date, :date_time\n convert_time(value, book)\nelse\n convert_unknown(value)\nend\n"}}]},{"html_id":"xlsx-parser/XlsxParser/Styles/Parser","path":"XlsxParser/Styles/Parser.html","kind":"class","full_name":"XlsxParser::Styles::Parser","name":"Parser","abstract":false,"superclass":{"html_id":"xlsx-parser/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"xlsx-parser/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"xlsx-parser/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/xlsx-parser/styles/parser.cr","line_number":2,"url":"https://github.com/D1ceWard/xlsx-parser/blob/af40bfbe992c5694e30eeadc6abd8803dc14a99d/src/xlsx-parser/styles/parser.cr#L2"}],"repository_name":"xlsx-parser","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"xlsx-parser/XlsxParser/Styles","kind":"module","full_name":"XlsxParser::Styles","name":"Styles"},"class_methods":[{"html_id":"call(book:Book):Array(Symbol?)-class-method","name":"call","abstract":false,"args":[{"name":"book","external_name":"book","restriction":"Book"}],"args_string":"(book : Book) : Array(Symbol?)","args_html":"(book : Book) : Array(Symbol?)","location":{"filename":"src/xlsx-parser/styles/parser.cr","line_number":3,"url":"https://github.com/D1ceWard/xlsx-parser/blob/af40bfbe992c5694e30eeadc6abd8803dc14a99d/src/xlsx-parser/styles/parser.cr#L3"},"def":{"name":"call","args":[{"name":"book","external_name":"book","restriction":"Book"}],"return_type":"Array(Symbol | Nil)","visibility":"Public","body":"if (styles_file = book.zip[\"xl/styles.xml\"]?)\nelse\n return [] of Symbol | ::Nil\nend\nstyles = XML.parse(styles_file.open(&.gets_to_end))\ncustom_style_types = parse_custom_style_types(styles)\nstyles_nodes = styles.xpath_nodes(\"//*[name()='styleSheet']//*[name()='cellXfs']//*[name()='xf']\")\nstyles_nodes.map do |xstyle|\n if ( num_fmt_id = xstyle.attributes[\"numFmtId\"]?.try(&.content).try(&.to_i))\n else\n next\n end\n NumFmtMap[num_fmt_id]? || custom_style_types[num_fmt_id]\nend\n"}}]}]}]}]}}) \ No newline at end of file diff --git a/shard.yml b/shard.yml index 37b22a2..0178347 100644 --- a/shard.yml +++ b/shard.yml @@ -1,5 +1,5 @@ name: xlsx-parser -version: 1.0.1 +version: 1.0.2 authors: - D1ceWard description: Crystal wrapper for parsing .xlsx spreadsheets diff --git a/src/xlsx-parser.cr b/src/xlsx-parser.cr index d61d72f..a697102 100644 --- a/src/xlsx-parser.cr +++ b/src/xlsx-parser.cr @@ -3,5 +3,5 @@ require "./xlsx-parser/sheet" require "./xlsx-parser/styles" module XlsxParser - VERSION = "1.0.1" + VERSION = "1.0.2" end