rubyXL 2.1.1 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (234) hide show
  1. data/VERSION +1 -1
  2. data/lib/rubyXL.rb +1 -0
  3. data/lib/rubyXL/objects/border.rb +3 -4
  4. data/lib/rubyXL/objects/calculation_chain.rb +1 -1
  5. data/lib/rubyXL/objects/cell_style.rb +3 -4
  6. data/lib/rubyXL/objects/chartsheet.rb +78 -0
  7. data/lib/rubyXL/objects/container_nodes.rb +2 -3
  8. data/lib/rubyXL/objects/data_validation.rb +5 -10
  9. data/lib/rubyXL/objects/document_properties.rb +1 -1
  10. data/lib/rubyXL/objects/fill.rb +3 -6
  11. data/lib/rubyXL/objects/filters.rb +120 -0
  12. data/lib/rubyXL/objects/formula.rb +2 -2
  13. data/lib/rubyXL/objects/ooxml_object.rb +116 -56
  14. data/lib/rubyXL/objects/relationships.rb +5 -1
  15. data/lib/rubyXL/objects/shared_strings.rb +1 -1
  16. data/lib/rubyXL/objects/sheet_common.rb +50 -0
  17. data/lib/rubyXL/objects/sheet_data.rb +6 -1
  18. data/lib/rubyXL/objects/simple_types.rb +78 -0
  19. data/lib/rubyXL/objects/stylesheet.rb +15 -3
  20. data/lib/rubyXL/objects/text.rb +4 -5
  21. data/lib/rubyXL/objects/workbook.rb +151 -26
  22. data/lib/rubyXL/objects/worksheet.rb +329 -107
  23. data/lib/rubyXL/parser.rb +12 -11
  24. data/lib/rubyXL/workbook.rb +3 -2
  25. data/rdoc/README_rdoc.html +404 -0
  26. data/rdoc/RubyXL.html +337 -0
  27. data/rdoc/RubyXL/AExtensionStorageArea.html +105 -0
  28. data/rdoc/RubyXL/Alignment.html +108 -0
  29. data/rdoc/RubyXL/AlternateContent.html +105 -0
  30. data/rdoc/RubyXL/AutoFilter.html +105 -0
  31. data/rdoc/RubyXL/AutoFilterColumn.html +105 -0
  32. data/rdoc/RubyXL/BooleanNode.html +105 -0
  33. data/rdoc/RubyXL/BooleanValue.html +105 -0
  34. data/rdoc/RubyXL/Border.html +105 -0
  35. data/rdoc/RubyXL/BorderContainer.html +105 -0
  36. data/rdoc/RubyXL/BorderEdge.html +156 -0
  37. data/rdoc/RubyXL/Break.html +105 -0
  38. data/rdoc/RubyXL/BreakList.html +105 -0
  39. data/rdoc/RubyXL/CalculationChain.html +159 -0
  40. data/rdoc/RubyXL/CalculationChainCell.html +108 -0
  41. data/rdoc/RubyXL/CalculationProperties.html +105 -0
  42. data/rdoc/RubyXL/Cell.html +428 -0
  43. data/rdoc/RubyXL/CellSmartTag.html +105 -0
  44. data/rdoc/RubyXL/CellSmartTagContainer.html +105 -0
  45. data/rdoc/RubyXL/CellSmartTagProperty.html +105 -0
  46. data/rdoc/RubyXL/CellStyle.html +108 -0
  47. data/rdoc/RubyXL/CellStyleContainer.html +105 -0
  48. data/rdoc/RubyXL/CellStyleXFContainer.html +105 -0
  49. data/rdoc/RubyXL/CellValue.html +108 -0
  50. data/rdoc/RubyXL/CellWatch.html +105 -0
  51. data/rdoc/RubyXL/CellWatchContainer.html +105 -0
  52. data/rdoc/RubyXL/CellXFContainer.html +105 -0
  53. data/rdoc/RubyXL/Chartsheet.html +105 -0
  54. data/rdoc/RubyXL/ChartsheetPageSetup.html +105 -0
  55. data/rdoc/RubyXL/ChartsheetProperties.html +108 -0
  56. data/rdoc/RubyXL/ChartsheetProtection.html +108 -0
  57. data/rdoc/RubyXL/ChartsheetView.html +105 -0
  58. data/rdoc/RubyXL/ChartsheetViewContainer.html +105 -0
  59. data/rdoc/RubyXL/Color.html +163 -0
  60. data/rdoc/RubyXL/ColorFilter.html +105 -0
  61. data/rdoc/RubyXL/ColorScale.html +105 -0
  62. data/rdoc/RubyXL/ColorScheme.html +105 -0
  63. data/rdoc/RubyXL/ColorSet.html +105 -0
  64. data/rdoc/RubyXL/Colors.html +105 -0
  65. data/rdoc/RubyXL/ColumnRange.html +233 -0
  66. data/rdoc/RubyXL/ColumnRanges.html +275 -0
  67. data/rdoc/RubyXL/ConditionalFormatValue.html +105 -0
  68. data/rdoc/RubyXL/ConditionalFormatting.html +105 -0
  69. data/rdoc/RubyXL/ConditionalFormattingRule.html +105 -0
  70. data/rdoc/RubyXL/CustomFilter.html +105 -0
  71. data/rdoc/RubyXL/CustomFilterContainer.html +105 -0
  72. data/rdoc/RubyXL/CustomProperty.html +105 -0
  73. data/rdoc/RubyXL/CustomPropertyContainer.html +105 -0
  74. data/rdoc/RubyXL/CustomSheetView.html +105 -0
  75. data/rdoc/RubyXL/CustomSheetViews.html +105 -0
  76. data/rdoc/RubyXL/CustomWorkbookView.html +105 -0
  77. data/rdoc/RubyXL/CustomWorkbookViewContainer.html +105 -0
  78. data/rdoc/RubyXL/DXF.html +105 -0
  79. data/rdoc/RubyXL/DXFs.html +105 -0
  80. data/rdoc/RubyXL/DataBar.html +105 -0
  81. data/rdoc/RubyXL/DataConsolidate.html +105 -0
  82. data/rdoc/RubyXL/DataConsolidationReference.html +105 -0
  83. data/rdoc/RubyXL/DataConsolidationReferences.html +105 -0
  84. data/rdoc/RubyXL/DataValidation.html +108 -0
  85. data/rdoc/RubyXL/DataValidations.html +105 -0
  86. data/rdoc/RubyXL/DateGroupItem.html +108 -0
  87. data/rdoc/RubyXL/DefinedName.html +105 -0
  88. data/rdoc/RubyXL/DefinedNames.html +105 -0
  89. data/rdoc/RubyXL/DocumentProperties.html +271 -0
  90. data/rdoc/RubyXL/DynamicFilter.html +105 -0
  91. data/rdoc/RubyXL/EmbeddedControl.html +105 -0
  92. data/rdoc/RubyXL/EmbeddedControlContainer.html +105 -0
  93. data/rdoc/RubyXL/Extension.html +228 -0
  94. data/rdoc/RubyXL/ExtensionStorageArea.html +108 -0
  95. data/rdoc/RubyXL/ExternalReference.html +105 -0
  96. data/rdoc/RubyXL/ExternalReferences.html +105 -0
  97. data/rdoc/RubyXL/FieldItem.html +105 -0
  98. data/rdoc/RubyXL/FileRecoveryProperties.html +105 -0
  99. data/rdoc/RubyXL/FileSharing.html +108 -0
  100. data/rdoc/RubyXL/FileVersion.html +108 -0
  101. data/rdoc/RubyXL/Fill.html +105 -0
  102. data/rdoc/RubyXL/FillContainer.html +105 -0
  103. data/rdoc/RubyXL/FilterContainer.html +105 -0
  104. data/rdoc/RubyXL/FloatNode.html +105 -0
  105. data/rdoc/RubyXL/FloatValue.html +105 -0
  106. data/rdoc/RubyXL/Font.html +655 -0
  107. data/rdoc/RubyXL/FontContainer.html +105 -0
  108. data/rdoc/RubyXL/FontScheme.html +105 -0
  109. data/rdoc/RubyXL/FormatScheme.html +105 -0
  110. data/rdoc/RubyXL/Formula.html +108 -0
  111. data/rdoc/RubyXL/FunctionGroup.html +105 -0
  112. data/rdoc/RubyXL/FunctionGroupContainer.html +105 -0
  113. data/rdoc/RubyXL/GenericStorage.html +344 -0
  114. data/rdoc/RubyXL/GradientFill.html +105 -0
  115. data/rdoc/RubyXL/HeaderFooterSettings.html +105 -0
  116. data/rdoc/RubyXL/Hyperlink.html +105 -0
  117. data/rdoc/RubyXL/HyperlinkContainer.html +105 -0
  118. data/rdoc/RubyXL/IconFilter.html +105 -0
  119. data/rdoc/RubyXL/IconSet.html +105 -0
  120. data/rdoc/RubyXL/IgnoredError.html +105 -0
  121. data/rdoc/RubyXL/IgnoredErrorContainer.html +105 -0
  122. data/rdoc/RubyXL/IndexedColorContainer.html +105 -0
  123. data/rdoc/RubyXL/InputCells.html +105 -0
  124. data/rdoc/RubyXL/IntegerNode.html +105 -0
  125. data/rdoc/RubyXL/IntegerValue.html +105 -0
  126. data/rdoc/RubyXL/LegacyCell.html +1498 -0
  127. data/rdoc/RubyXL/LegacyWorkbook.html +1283 -0
  128. data/rdoc/RubyXL/LegacyWorksheet.html +3291 -0
  129. data/rdoc/RubyXL/MRUColorContainer.html +105 -0
  130. data/rdoc/RubyXL/MergedCell.html +105 -0
  131. data/rdoc/RubyXL/MergedCells.html +105 -0
  132. data/rdoc/RubyXL/NumFmt.html +105 -0
  133. data/rdoc/RubyXL/NumberFormat.html +160 -0
  134. data/rdoc/RubyXL/NumberFormatContainer.html +173 -0
  135. data/rdoc/RubyXL/OLEObject.html +105 -0
  136. data/rdoc/RubyXL/OLEObjects.html +105 -0
  137. data/rdoc/RubyXL/OLESize.html +105 -0
  138. data/rdoc/RubyXL/OOXMLObject.html +862 -0
  139. data/rdoc/RubyXL/OOXMLTopLevelObject.html +105 -0
  140. data/rdoc/RubyXL/OutlineProperties.html +108 -0
  141. data/rdoc/RubyXL/PageMargins.html +105 -0
  142. data/rdoc/RubyXL/PageSetup.html +105 -0
  143. data/rdoc/RubyXL/PageSetupProperties.html +108 -0
  144. data/rdoc/RubyXL/Pane.html +105 -0
  145. data/rdoc/RubyXL/Parser.html +348 -0
  146. data/rdoc/RubyXL/PatternFill.html +105 -0
  147. data/rdoc/RubyXL/PhoneticProperties.html +105 -0
  148. data/rdoc/RubyXL/PhoneticRun.html +105 -0
  149. data/rdoc/RubyXL/PivotArea.html +105 -0
  150. data/rdoc/RubyXL/PivotCache.html +105 -0
  151. data/rdoc/RubyXL/PivotCaches.html +105 -0
  152. data/rdoc/RubyXL/PivotReference.html +105 -0
  153. data/rdoc/RubyXL/PivotReferenceContainer.html +105 -0
  154. data/rdoc/RubyXL/PivotTableSelection.html +105 -0
  155. data/rdoc/RubyXL/PrintOptions.html +105 -0
  156. data/rdoc/RubyXL/ProtectedRange.html +105 -0
  157. data/rdoc/RubyXL/ProtectedRanges.html +105 -0
  158. data/rdoc/RubyXL/Protection.html +105 -0
  159. data/rdoc/RubyXL/RID.html +105 -0
  160. data/rdoc/RubyXL/RawOOXML.html +225 -0
  161. data/rdoc/RubyXL/Reference.html +642 -0
  162. data/rdoc/RubyXL/Relationship.html +105 -0
  163. data/rdoc/RubyXL/RichText.html +105 -0
  164. data/rdoc/RubyXL/RichTextRun.html +105 -0
  165. data/rdoc/RubyXL/Row.html +105 -0
  166. data/rdoc/RubyXL/RunProperties.html +108 -0
  167. data/rdoc/RubyXL/Scenario.html +105 -0
  168. data/rdoc/RubyXL/ScenarioContainer.html +105 -0
  169. data/rdoc/RubyXL/Selection.html +105 -0
  170. data/rdoc/RubyXL/SharedStringsTable.html +397 -0
  171. data/rdoc/RubyXL/Sheet.html +105 -0
  172. data/rdoc/RubyXL/SheetCalculationProperties.html +105 -0
  173. data/rdoc/RubyXL/SheetData.html +105 -0
  174. data/rdoc/RubyXL/Sheets.html +105 -0
  175. data/rdoc/RubyXL/SmartTagContainer.html +105 -0
  176. data/rdoc/RubyXL/SmartTagProperties.html +105 -0
  177. data/rdoc/RubyXL/SmartTagType.html +105 -0
  178. data/rdoc/RubyXL/SmartTagTypeContainer.html +105 -0
  179. data/rdoc/RubyXL/SortCondition.html +105 -0
  180. data/rdoc/RubyXL/SortState.html +105 -0
  181. data/rdoc/RubyXL/Sqref.html +199 -0
  182. data/rdoc/RubyXL/Stop.html +108 -0
  183. data/rdoc/RubyXL/StringNode.html +105 -0
  184. data/rdoc/RubyXL/StringValue.html +105 -0
  185. data/rdoc/RubyXL/Stylesheet.html +105 -0
  186. data/rdoc/RubyXL/TableParts.html +105 -0
  187. data/rdoc/RubyXL/TableStyle.html +105 -0
  188. data/rdoc/RubyXL/TableStyles.html +105 -0
  189. data/rdoc/RubyXL/Text.html +195 -0
  190. data/rdoc/RubyXL/Theme.html +105 -0
  191. data/rdoc/RubyXL/ThemeElements.html +105 -0
  192. data/rdoc/RubyXL/Top10.html +105 -0
  193. data/rdoc/RubyXL/Variant.html +108 -0
  194. data/rdoc/RubyXL/Vector.html +105 -0
  195. data/rdoc/RubyXL/VectorValue.html +105 -0
  196. data/rdoc/RubyXL/WebPublishObject.html +105 -0
  197. data/rdoc/RubyXL/WebPublishObjectContainer.html +105 -0
  198. data/rdoc/RubyXL/WebPublishingItem.html +108 -0
  199. data/rdoc/RubyXL/WebPublishingItemContainer.html +105 -0
  200. data/rdoc/RubyXL/WebPublishingProperties.html +105 -0
  201. data/rdoc/RubyXL/Workbook.html +105 -0
  202. data/rdoc/RubyXL/WorkbookProperties.html +108 -0
  203. data/rdoc/RubyXL/WorkbookProtection.html +105 -0
  204. data/rdoc/RubyXL/WorkbookRelationships.html +316 -0
  205. data/rdoc/RubyXL/WorkbookView.html +105 -0
  206. data/rdoc/RubyXL/WorkbookViews.html +105 -0
  207. data/rdoc/RubyXL/Worksheet.html +105 -0
  208. data/rdoc/RubyXL/WorksheetDimensions.html +105 -0
  209. data/rdoc/RubyXL/WorksheetFormatProperties.html +105 -0
  210. data/rdoc/RubyXL/WorksheetProperties.html +108 -0
  211. data/rdoc/RubyXL/WorksheetProtection.html +105 -0
  212. data/rdoc/RubyXL/WorksheetView.html +105 -0
  213. data/rdoc/RubyXL/WorksheetViews.html +105 -0
  214. data/rdoc/RubyXL/Writer.html +98 -0
  215. data/rdoc/RubyXL/Writer/ContentTypesWriter.html +289 -0
  216. data/rdoc/RubyXL/Writer/CoreWriter.html +210 -0
  217. data/rdoc/RubyXL/Writer/GenericWriter.html +348 -0
  218. data/rdoc/RubyXL/Writer/RootRelsWriter.html +193 -0
  219. data/rdoc/RubyXL/Writer/StylesWriter.html +191 -0
  220. data/rdoc/RubyXL/Writer/ThemeWriter.html +511 -0
  221. data/rdoc/RubyXL/Writer/WorkbookWriter.html +249 -0
  222. data/rdoc/RubyXL/Writer/WorksheetWriter.html +236 -0
  223. data/rdoc/RubyXL/XF.html +105 -0
  224. data/rdoc/created.rid +24 -21
  225. data/rdoc/index.html +216 -0
  226. data/rdoc/js/search_index.js +1 -1
  227. data/rdoc/table_of_contents.html +1496 -0
  228. data/rubyXL.gemspec +211 -4
  229. data/spec/lib/parser_spec.rb +18 -6
  230. data/test/input/.gitkeep +0 -0
  231. data/test/output/.gitkeep +0 -0
  232. data/test/test_parse_write.rb +15 -0
  233. metadata +211 -4
  234. data/lib/rubyXL/objects/sheet_view.rb +0 -71
data/lib/rubyXL/parser.rb CHANGED
@@ -44,17 +44,18 @@ module RubyXL
44
44
  wb.relationship_container = RubyXL::WorkbookRelationships.parse_file(dir_path)
45
45
 
46
46
  unless @data_only
47
- wb.media = RubyXL::GenericStorage.new(File.join('xl', 'media')).binary.load_dir(dir_path)
48
- wb.external_links = RubyXL::GenericStorage.new(File.join('xl', 'externalLinks')).load_dir(dir_path)
49
- wb.external_links_rels = RubyXL::GenericStorage.new(File.join('xl', 'externalLinks', '_rels')).load_dir(dir_path)
50
- wb.drawings = RubyXL::GenericStorage.new(File.join('xl', 'drawings')).load_dir(dir_path)
51
- wb.drawings_rels = RubyXL::GenericStorage.new(File.join('xl', 'drawings', '_rels')).load_dir(dir_path)
52
- wb.charts = RubyXL::GenericStorage.new(File.join('xl', 'charts')).load_dir(dir_path)
53
- wb.chart_rels = RubyXL::GenericStorage.new(File.join('xl', 'charts', '_rels')).load_dir(dir_path)
54
- wb.printer_settings = RubyXL::GenericStorage.new(File.join('xl', 'printerSettings')).binary.load_dir(dir_path)
55
- wb.worksheet_rels = RubyXL::GenericStorage.new(File.join('xl', 'worksheets', '_rels')).load_dir(dir_path)
56
- wb.macros = RubyXL::GenericStorage.new('xl').binary.load_file(dir_path, 'vbaProject.bin')
57
- wb.theme = RubyXL::GenericStorage.new(File.join('xl', 'theme')).load_file(dir_path, 'theme1.xml')
47
+ wb.media.load_dir(dir_path)
48
+ wb.external_links.load_dir(dir_path)
49
+ wb.external_links_rels.load_dir(dir_path)
50
+ wb.drawings.load_dir(dir_path)
51
+ wb.drawings_rels.load_dir(dir_path)
52
+ wb.charts.load_dir(dir_path)
53
+ wb.chart_rels.load_dir(dir_path)
54
+ wb.printer_settings.load_dir(dir_path)
55
+ wb.worksheet_rels.load_dir(dir_path)
56
+ wb.chartsheet_rels.load_dir(dir_path)
57
+ wb.macros.load_file(dir_path, 'vbaProject.bin')
58
+ wb.theme.load_file(dir_path, 'theme1.xml')
58
59
 
59
60
  core_file = Nokogiri::XML.parse(File.open(File.join(dir_path, 'docProps', 'core.xml'), 'r'))
60
61
  wb.creator = core_file.css('dc|creator').children.to_s
@@ -14,7 +14,7 @@ module RubyXL
14
14
  include Enumerable
15
15
  attr_accessor :worksheets, :filepath, :creator, :modifier, :created_at, :modified_at, :theme,
16
16
  :media, :external_links, :external_links_rels, :drawings, :drawings_rels, :charts, :chart_rels,
17
- :worksheet_rels, :printer_settings, :macros
17
+ :worksheet_rels, :chartsheet_rels, :printer_settings, :macros
18
18
 
19
19
  attr_accessor :stylesheet, :shared_strings_container, :document_properties, :calculation_chain,
20
20
  :relationship_container
@@ -45,6 +45,7 @@ module RubyXL
45
45
  @charts = RubyXL::GenericStorage.new(File.join('xl', 'charts'))
46
46
  @chart_rels = RubyXL::GenericStorage.new(File.join('xl', 'charts', '_rels'))
47
47
  @worksheet_rels = RubyXL::GenericStorage.new(File.join('xl', 'worksheets', '_rels'))
48
+ @chartsheet_rels = RubyXL::GenericStorage.new(File.join('xl', 'chartsheets', '_rels'))
48
49
  @theme = RubyXL::GenericStorage.new(File.join('xl', 'theme'))
49
50
  @printer_settings = RubyXL::GenericStorage.new(File.join('xl', 'printerSettings')).binary
50
51
  @macros = RubyXL::GenericStorage.new('xl').binary
@@ -121,7 +122,7 @@ module RubyXL
121
122
 
122
123
  [ @media, @external_links, @external_links_rels,
123
124
  @drawings, @drawings_rels, @charts, @chart_rels,
124
- @printer_settings, @worksheet_rels, @macros ].each { |s| s.add_to_zip(zipfile) }
125
+ @printer_settings, @worksheet_rels, @chartsheet_rels, @macros ].each { |s| s.add_to_zip(zipfile) }
125
126
 
126
127
  @worksheets.each_index { |i| Writer::WorksheetWriter.new(self, i).add_to_zip(zipfile) }
127
128
  }
@@ -0,0 +1,404 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta charset="UTF-8">
6
+
7
+ <title>README - rubyXL 2.1.3</title>
8
+
9
+ <link href="./fonts.css" rel="stylesheet">
10
+ <link href="./rdoc.css" rel="stylesheet">
11
+
12
+ <script type="text/javascript">
13
+ var rdoc_rel_prefix = "./";
14
+ </script>
15
+
16
+ <script src="./js/jquery.js"></script>
17
+ <script src="./js/navigation.js"></script>
18
+ <script src="./js/search_index.js"></script>
19
+ <script src="./js/search.js"></script>
20
+ <script src="./js/searcher.js"></script>
21
+ <script src="./js/darkfish.js"></script>
22
+
23
+
24
+ <body id="top" role="document" class="file">
25
+ <nav role="navigation">
26
+ <div id="project-navigation">
27
+ <div id="home-section" role="region" title="Quick navigation" class="nav-section">
28
+ <h2>
29
+ <a href="./index.html" rel="home">Home</a>
30
+ </h2>
31
+
32
+ <div id="table-of-contents-navigation">
33
+ <a href="./table_of_contents.html#pages">Pages</a>
34
+ <a href="./table_of_contents.html#classes">Classes</a>
35
+ <a href="./table_of_contents.html#methods">Methods</a>
36
+ </div>
37
+ </div>
38
+
39
+ <div id="search-section" role="search" class="project-section initially-hidden">
40
+ <form action="#" method="get" accept-charset="utf-8">
41
+ <div id="search-field-wrapper">
42
+ <input id="search-field" role="combobox" aria-label="Search"
43
+ aria-autocomplete="list" aria-controls="search-results"
44
+ type="text" name="search" placeholder="Search" spellcheck="false"
45
+ title="Type to search, Up and Down to navigate, Enter to load">
46
+ </div>
47
+
48
+ <ul id="search-results" aria-label="Search Results"
49
+ aria-busy="false" aria-expanded="false"
50
+ aria-atomic="false" class="initially-hidden"></ul>
51
+ </form>
52
+ </div>
53
+
54
+ </div>
55
+
56
+
57
+ <div class="nav-section">
58
+ <h3>Table of Contents</h3>
59
+
60
+ <ul class="link-list" role="directory">
61
+ <li><a href="#label-rubyXL">rubyXL</a>
62
+ <li><a href="#label-To+Install%3A">To Install:</a>
63
+ <li><a href="#label-To+Use%3A">To Use:</a>
64
+ <li><a href="#label-Parsing+an+existing+workbook">Parsing an existing workbook</a>
65
+ <li><a href="#label-Creating+a+new+Workbook">Creating a new Workbook</a>
66
+ <li><a href="#label-Accessing">Accessing</a>
67
+ <li><a href="#label-Accessing+a+Worksheet">Accessing a Worksheet</a>
68
+ <li><a href="#label-Accessing+just+the+values">Accessing just the values</a>
69
+ <li><a href="#label-Accessing+a+Row+%28Array+of+Cells%29">Accessing a Row (Array of Cells)</a>
70
+ <li><a href="#label-Accessing+a+Cell+object">Accessing a Cell object</a>
71
+ <li><a href="#label-Wrappers+for+accessing+Cell+properties">Wrappers for accessing Cell properties</a>
72
+ <li><a href="#label-Wrappers+for+accessing+Row+properties+">Wrappers for accessing Row properties </a>
73
+ <li><a href="#label-Accessing+column+properties">Accessing column properties</a>
74
+ <li><a href="#label-Table+identification">Table identification</a>
75
+ <li><a href="#label-Modifying">Modifying</a>
76
+ <li><a href="#label-Adding+Worksheets">Adding Worksheets</a>
77
+ <li><a href="#label-Adding+Cells">Adding Cells</a>
78
+ <li><a href="#label-Changing+Cells">Changing Cells</a>
79
+ <li><a href="#label-Changing+Fonts">Changing Fonts</a>
80
+ <li><a href="#label-Changing+Fills+++++">Changing Fills </a>
81
+ <li><a href="#label-Changing+Borders">Changing Borders</a>
82
+ <li><a href="#label-Changing+Alignment">Changing Alignment</a>
83
+ <li><a href="#label-Horizontal">Horizontal</a>
84
+ <li><a href="#label-Vertical">Vertical</a>
85
+ <li><a href="#label-Changing+Row+Height">Changing Row Height</a>
86
+ <li><a href="#label-Changing+Column+Width">Changing Column Width</a>
87
+ <li><a href="#label-Merging+Cells">Merging Cells</a>
88
+ <li><a href="#label-Insert+Row">Insert Row</a>
89
+ <li><a href="#label-Insert+Column">Insert Column</a>
90
+ <li><a href="#label-Delete+Row">Delete Row</a>
91
+ <li><a href="#label-Delete+Column">Delete Column</a>
92
+ <li><a href="#label-Insert+Cell">Insert Cell</a>
93
+ <li><a href="#label-Delete+Cell">Delete Cell</a>
94
+ <li><a href="#label-Writing">Writing</a>
95
+ <li><a href="#label-Miscellaneous">Miscellaneous</a>
96
+ <li><a href="#label-For+more+information">For more information</a>
97
+ <li><a href="#label-Contributing+to+rubyXL">Contributing to rubyXL</a>
98
+ <li><a href="#label-Copyright">Copyright</a>
99
+ </ul>
100
+ </div>
101
+
102
+
103
+ <div id="project-metadata">
104
+ <div id="fileindex-section" class="nav-section">
105
+ <h3>Pages</h3>
106
+
107
+ <ul class="link-list">
108
+
109
+ <li><a href="./README_rdoc.html">README</a>
110
+
111
+ </ul>
112
+ </div>
113
+
114
+ </div>
115
+ </nav>
116
+
117
+ <main role="main" aria-label="Page README.rdoc">
118
+
119
+ <h1 id="label-rubyXL">rubyXL<span><a href="#label-rubyXL">&para;</a> <a href="#documentation">&uarr;</a></span></h1>
120
+
121
+ <h2 id="label-To+Install%3A">To Install:<span><a href="#label-To+Install%3A">&para;</a> <a href="#documentation">&uarr;</a></span></h2>
122
+
123
+ <pre>gem install rubyXL</pre>
124
+
125
+ <h2 id="label-To+Use%3A">To Use:<span><a href="#label-To+Use%3A">&para;</a> <a href="#documentation">&uarr;</a></span></h2>
126
+
127
+ <pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">'rubyXL'</span> <span class="ruby-comment"># Assuming rubygems is already required</span>
128
+ </pre>
129
+
130
+ <h3 id="label-Parsing+an+existing+workbook">Parsing an existing workbook<span><a href="#label-Parsing+an+existing+workbook">&para;</a> <a href="#documentation">&uarr;</a></span></h3>
131
+
132
+ <pre>workbook = RubyXL::Parser.parse(&quot;path/to/Excel/file.xlsx&quot;)</pre>
133
+
134
+ <h3 id="label-Creating+a+new+Workbook">Creating a new Workbook<span><a href="#label-Creating+a+new+Workbook">&para;</a> <a href="#documentation">&uarr;</a></span></h3>
135
+
136
+ <pre>workbook = RubyXL::Workbook.new</pre>
137
+
138
+ <h3 id="label-Accessing">Accessing<span><a href="#label-Accessing">&para;</a> <a href="#documentation">&uarr;</a></span></h3>
139
+
140
+ <h4 id="label-Accessing+a+Worksheet">Accessing a Worksheet<span><a href="#label-Accessing+a+Worksheet">&para;</a> <a href="#documentation">&uarr;</a></span></h4>
141
+
142
+ <pre>workbook.worksheets[0] # Returns first worksheet
143
+ workbook[0] # Returns first worksheet
144
+ workbook['Sheet1'] # Finds and returns worksheet titled &quot;Sheet1&quot;</pre>
145
+
146
+ <h4 id="label-Accessing+just+the+values">Accessing just the values<span><a href="#label-Accessing+just+the+values">&para;</a> <a href="#documentation">&uarr;</a></span></h4>
147
+
148
+ <pre>worksheet = workbook[0]
149
+ worksheet.extract_data # Produces a simple rectangular array that consists only of cell values (rather than the Cell objects)</pre>
150
+
151
+ <h4 id="label-Accessing+a+Row+%28Array+of+Cells%29">Accessing a Row (Array of Cells)<span><a href="#label-Accessing+a+Row+%28Array+of+Cells%29">&para;</a> <a href="#documentation">&uarr;</a></span></h4>
152
+
153
+ <pre>worksheet = workbook[0]
154
+ worksheet.sheet_data[0] # Returns first row of the worksheet
155
+ worksheet[0] # Returns first row of the worksheet</pre>
156
+
157
+ <h4 id="label-Accessing+a+Cell+object">Accessing a Cell object<span><a href="#label-Accessing+a+Cell+object">&para;</a> <a href="#documentation">&uarr;</a></span></h4>
158
+
159
+ <pre>worksheet = workbook[0]
160
+ worksheet.sheet_data[0][0] # Returns cell A1 in the worksheet
161
+ worksheet[0][0] # Returns cell A1 in the worksheet</pre>
162
+
163
+ <h4 id="label-Wrappers+for+accessing+Cell+properties">Wrappers for accessing Cell properties<span><a href="#label-Wrappers+for+accessing+Cell+properties">&para;</a> <a href="#documentation">&uarr;</a></span></h4>
164
+
165
+ <pre>cell = workbook[0][0][0]
166
+ cell.is_struckthrough # Returns +true+ if the cell is struckthrough, other boolean properties have same syntax
167
+ cell.font_name
168
+ cell.font_size
169
+ cell.font_color
170
+ cell.fill_color
171
+ cell.horizontal_alignment
172
+ cell.vertical_alignment
173
+ cell.border_top</pre>
174
+
175
+ <h4 id="label-Wrappers+for+accessing+Row+properties+">Wrappers for accessing Row properties <span><a href="#label-Wrappers+for+accessing+Row+properties+">&para;</a> <a href="#documentation">&uarr;</a></span></h4>
176
+
177
+ <p>Please note: these methods are being phased out in favor of the OOXML
178
+ object model.</p>
179
+
180
+ <pre>worksheet = workbook[0]
181
+ worksheet.get_row_fill(0)
182
+ worksheet.get_row_font_name(0)
183
+ worksheet.get_row_font_size(0)
184
+ worksheet.get_row_font_color(0)
185
+ worksheet.is_row_underlined(0)
186
+ worksheet.get_row_height(0)
187
+ worksheet.get_row_horizontal_alignment(0)
188
+ worksheet.get_row_vertical_alignment(0)
189
+ worksheet.get_row_border_right(0)</pre>
190
+
191
+ <h4 id="label-Accessing+column+properties">Accessing column properties<span><a href="#label-Accessing+column+properties">&para;</a> <a href="#documentation">&uarr;</a></span></h4>
192
+
193
+ <p>Please note: these methods are being phased out in favor of the OOXML
194
+ object model.</p>
195
+
196
+ <pre>worksheet = workbook[0]
197
+ worksheet.get_column_fill(0)
198
+ worksheet.get_column_font_name(0)
199
+ worksheet.get_column_font_size(0)
200
+ worksheet.get_column_font_color(0)
201
+ worksheet.is_column_underlined(0)
202
+ worksheet.get_column_height(0)
203
+ worksheet.get_column_horizontal_alignment(0)
204
+ worksheet.get_column_vertical_alignment(0)
205
+ worksheet.get_column_border_right(0)</pre>
206
+
207
+ <h4 id="label-Table+identification">Table identification<span><a href="#label-Table+identification">&para;</a> <a href="#documentation">&uarr;</a></span></h4>
208
+
209
+ <pre class="ruby"><span class="ruby-identifier">worksheet</span> = <span class="ruby-identifier">workbook</span>[<span class="ruby-value">0</span>]
210
+ <span class="ruby-identifier">worksheet</span>.<span class="ruby-identifier">get_table</span>([<span class="ruby-string">&quot;NAME&quot;</span>, <span class="ruby-string">&quot;AGE&quot;</span>, <span class="ruby-string">&quot;HEIGHT&quot;</span>]) <span class="ruby-comment"># Returns hash of a table in the first worksheet, with the specified strings as headers, accessible by row and column</span>
211
+ <span class="ruby-comment">#it returns the following structure</span>
212
+ {
213
+ :<span class="ruby-constant">Name=</span><span class="ruby-operator">&gt;</span>[<span class="ruby-string">&quot;John&quot;</span>, <span class="ruby-string">&quot;Jane&quot;</span>, <span class="ruby-string">&quot;Joe&quot;</span>],
214
+ :<span class="ruby-constant">Height=</span><span class="ruby-operator">&gt;</span>[<span class="ruby-value">70</span>, <span class="ruby-value">65</span>, <span class="ruby-value">68</span>],
215
+ :<span class="ruby-constant">Age=</span><span class="ruby-operator">&gt;</span>[<span class="ruby-value">30</span>, <span class="ruby-value">25</span>, <span class="ruby-value">35</span>]
216
+ :<span class="ruby-identifier">table=</span><span class="ruby-operator">&gt;</span>[
217
+ {:<span class="ruby-constant">Name=</span><span class="ruby-operator">&gt;</span><span class="ruby-string">&quot;John&quot;</span>, :<span class="ruby-constant">Height=</span><span class="ruby-operator">&gt;</span><span class="ruby-value">70</span>, :<span class="ruby-constant">Age=</span><span class="ruby-operator">&gt;</span><span class="ruby-value">30</span>},
218
+ {:<span class="ruby-constant">Name=</span><span class="ruby-operator">&gt;</span><span class="ruby-string">&quot;Jane&quot;</span>, :<span class="ruby-constant">Height=</span><span class="ruby-operator">&gt;</span><span class="ruby-value">65</span>, :<span class="ruby-constant">Age=</span><span class="ruby-operator">&gt;</span><span class="ruby-value">25</span>},
219
+ {:<span class="ruby-constant">Name=</span><span class="ruby-operator">&gt;</span><span class="ruby-string">&quot;Joe&quot;</span>, :<span class="ruby-constant">Height=</span><span class="ruby-operator">&gt;</span><span class="ruby-value">68</span>, :<span class="ruby-constant">Age=</span><span class="ruby-operator">&gt;</span><span class="ruby-value">35</span>}
220
+ ]
221
+ }
222
+ </pre>
223
+
224
+ <h3 id="label-Modifying">Modifying<span><a href="#label-Modifying">&para;</a> <a href="#documentation">&uarr;</a></span></h3>
225
+
226
+ <h4 id="label-Adding+Worksheets">Adding Worksheets<span><a href="#label-Adding+Worksheets">&para;</a> <a href="#documentation">&uarr;</a></span></h4>
227
+
228
+ <pre>worlsheet = workbook.add_worksheet('Sheet2')</pre>
229
+
230
+ <h4 id="label-Adding+Cells">Adding Cells<span><a href="#label-Adding+Cells">&para;</a> <a href="#documentation">&uarr;</a></span></h4>
231
+
232
+ <pre>worksheet.add_cell(0, 0, 'A1') # Sets cell A1 to string &quot;A1&quot;
233
+ worksheet.add_cell(0, 1, '', 'A1') # Sets formula in the cell B1 to '=A1'</pre>
234
+
235
+ <h4 id="label-Changing+Cells">Changing Cells<span><a href="#label-Changing+Cells">&para;</a> <a href="#documentation">&uarr;</a></span></h4>
236
+
237
+ <pre>worksheet[0][0].change_contents(&quot;&quot;, worksheet[0][0].formula) # Sets value of cell A1 to empty string, preserves formula</pre>
238
+
239
+ <h4 id="label-Changing+Fonts">Changing Fonts<span><a href="#label-Changing+Fonts">&para;</a> <a href="#documentation">&uarr;</a></span></h4>
240
+
241
+ <pre>worksheet.sheet_data[0][0].change_font_bold(true) # Makes A1 bold
242
+ worksheet.change_row_italics(0,true) # Makes first row italicized
243
+ worksheet.change_column_font_name(0, 'Courier') # Makes first column have font Courier</pre>
244
+
245
+ <h4 id="label-Changing+Fills+++++">Changing Fills <span><a href="#label-Changing+Fills+++++">&para;</a> <a href="#documentation">&uarr;</a></span></h4>
246
+
247
+ <pre>worksheet.sheet_data[0][0].change_fill('0ba53d') # Sets A1 to have fill #0ba53d
248
+ worksheet.change_row_fill(0, '0ba53d') # Sets first row to have fill #0ba53d
249
+ worksheet.change_column_fill(0, '0ba53d') # Sets first column to have fill #0ba53d</pre>
250
+
251
+ <h4 id="label-Changing+Borders">Changing Borders<span><a href="#label-Changing+Borders">&para;</a> <a href="#documentation">&uarr;</a></span></h4>
252
+
253
+ <pre># Possible weights: hairline, thin, medium, thick
254
+ # Possible &quot;directions&quot;: top, bottom, left, right, diagonal
255
+ worksheet.sheet_data[0][0].change_border_top('thin') # Sets A1 to have a top, thin border
256
+ worksheet.change_row_border_left(0, 'hairline') # Sets first row to have a left, hairline border
257
+ worksheet.change_column_border_diagonal(0, 'medium') # Sets first column to have diagonal, medium border</pre>
258
+
259
+ <h4 id="label-Changing+Alignment">Changing Alignment<span><a href="#label-Changing+Alignment">&para;</a> <a href="#documentation">&uarr;</a></span></h4>
260
+
261
+ <h5 id="label-Horizontal">Horizontal<span><a href="#label-Horizontal">&para;</a> <a href="#documentation">&uarr;</a></span></h5>
262
+
263
+ <p>center, distributed, justify, left, right</p>
264
+
265
+ <pre>worksheet.sheet_data[0][0].change_horizontal_alignment('center') # Sets A1 to be centered
266
+ worksheet.change_row_horizontal_alignment(0, 'justify') # Sets first row to be justified
267
+ worksheet.change_column_horizontal_alignment(0, 'right') # Sets first column to be right-aligned</pre>
268
+
269
+ <h5 id="label-Vertical">Vertical<span><a href="#label-Vertical">&para;</a> <a href="#documentation">&uarr;</a></span></h5>
270
+
271
+ <p>bottom, center, distributed, top</p>
272
+
273
+ <pre>worksheet.sheet_data[0][0].change_vertical_alignment('bottom') # Sets A1 to be bottom aligned
274
+ worksheet.change_row_vertical_alignment(0, 'distributed') # Sets first row to be distributed vertically
275
+ worksheet.change_column_vertical_alignment(0, 'top') # Sets first column to be top aligned</pre>
276
+
277
+ <h4 id="label-Changing+Row+Height">Changing Row Height<span><a href="#label-Changing+Row+Height">&para;</a> <a href="#documentation">&uarr;</a></span></h4>
278
+
279
+ <pre>worksheet.change_row_height(0, 30) # Sets first row height to 30</pre>
280
+
281
+ <h4 id="label-Changing+Column+Width">Changing Column Width<span><a href="#label-Changing+Column+Width">&para;</a> <a href="#documentation">&uarr;</a></span></h4>
282
+
283
+ <pre>worksheet.change_column_width(0, 30) # Sets first column width to 30</pre>
284
+
285
+ <h4 id="label-Merging+Cells">Merging Cells<span><a href="#label-Merging+Cells">&para;</a> <a href="#documentation">&uarr;</a></span></h4>
286
+
287
+ <pre>worksheet.merge_cells(0, 0, 1, 1) # Merges A1:B2</pre>
288
+
289
+ <h4 id="label-Insert+Row">Insert Row<span><a href="#label-Insert+Row">&para;</a> <a href="#documentation">&uarr;</a></span></h4>
290
+
291
+ <p>This method will insert a row at specified index, pushing all rows below it
292
+ down. It also copies styles from row above.</p>
293
+
294
+ <p>WARNING: Use of this method WILL break formulas referencing cells which
295
+ have been moved, as the formulas do not adapt to the shifted rows</p>
296
+
297
+ <pre>worksheet.insert_row(1)</pre>
298
+
299
+ <h4 id="label-Insert+Column">Insert Column<span><a href="#label-Insert+Column">&para;</a> <a href="#documentation">&uarr;</a></span></h4>
300
+
301
+ <p>This method will insert a column at specified index, pushing all columns to
302
+ the right of it one to the right. It also copies styles from column to the
303
+ left</p>
304
+
305
+ <p>WARNING: Use of this method WILL break formulas referencing cells which
306
+ have been moved, as the formulas do not adapt to the shifted columns</p>
307
+
308
+ <pre>worksheet.insert_column(1)</pre>
309
+
310
+ <h4 id="label-Delete+Row">Delete Row<span><a href="#label-Delete+Row">&para;</a> <a href="#documentation">&uarr;</a></span></h4>
311
+
312
+ <p>This method will delete a row at specified index, pushing all rows below it
313
+ up.</p>
314
+
315
+ <p>WARNING: Use of this method WILL break formulas referencing cells which
316
+ have been moved, as the formulas do not adapt to the shifted rows</p>
317
+
318
+ <pre>worksheet.delete_row(1)</pre>
319
+
320
+ <h4 id="label-Delete+Column">Delete Column<span><a href="#label-Delete+Column">&para;</a> <a href="#documentation">&uarr;</a></span></h4>
321
+
322
+ <p>This method will delete a column at specified index, pushing all columns to
323
+ the right of it left.</p>
324
+
325
+ <p>WARNING: Use of this method WILL break formulas referencing cells which
326
+ have been moved, as the formulas do not adapt to the shifted columns</p>
327
+
328
+ <pre>worksheet.delete_column(1)</pre>
329
+
330
+ <h4 id="label-Insert+Cell">Insert Cell<span><a href="#label-Insert+Cell">&para;</a> <a href="#documentation">&uarr;</a></span></h4>
331
+
332
+ <p>This method will insert a cell at specified position. It takes a :right or
333
+ :down option, to shift cells either left or down upon inserting (nil means
334
+ replacing the cell)</p>
335
+
336
+ <p>WARNING: Use of this method WILL break formulas referencing cells which
337
+ have been moved, as the formulas do not adapt to the shifted cells</p>
338
+
339
+ <pre>worksheet.insert_cell(0, 0, &quot;blah&quot;, formula = nil, :right) # Inserts cell at A1, shifts cells in first row right
340
+ worksheet.insert_cell(0, 0, &quot;blah&quot;, formula = nil, :down) # Inserts cell at A1, shifts cells in first column down
341
+ worksheet.insert_cell(0, 0, &quot;blah&quot;) # Inserts cell at A1, shifts nothing</pre>
342
+
343
+ <h4 id="label-Delete+Cell">Delete Cell<span><a href="#label-Delete+Cell">&para;</a> <a href="#documentation">&uarr;</a></span></h4>
344
+
345
+ <p>This method will delete a cell at specified position. It takes a :left or
346
+ :up option, to shift cells either up or left upon deletion (nil means
347
+ simply deleting the cell contents)</p>
348
+
349
+ <p>WARNING: Use of this method WILL break formulas referencing cells which
350
+ have been moved, as the formulas do not adapt to the shifted cells</p>
351
+
352
+ <pre>worksheet.delete_cell(0, 0, :left) # Deletes A1, shifts contents of first row left
353
+ worksheet.delete_cell(0, 0, :up) # Deletes A1, shifts contents of first column up
354
+ worksheet.delete_cell(0, 0) # Deletes A1, does not shift cells</pre>
355
+
356
+ <h3 id="label-Writing">Writing<span><a href="#label-Writing">&para;</a> <a href="#documentation">&uarr;</a></span></h3>
357
+
358
+ <pre>workbook.write(&quot;path/to/desired/Excel/file.xlsx&quot;)</pre>
359
+
360
+ <h3 id="label-Miscellaneous">Miscellaneous<span><a href="#label-Miscellaneous">&para;</a> <a href="#documentation">&uarr;</a></span></h3>
361
+
362
+ <pre>Reference.ind2ref(0,0) == 'A1' # Converts row and column index to Excel-style cell reference
363
+ Reference.ref2ind('A1') == [0, 0] # Converts Excel-style cell reference to row and column index</pre>
364
+
365
+ <h2 id="label-For+more+information">For more information<span><a href="#label-For+more+information">&para;</a> <a href="#documentation">&uarr;</a></span></h2>
366
+
367
+ <p>Take a look at the files in spec/lib/ for rspecs on most methods</p>
368
+
369
+ <h2 id="label-Contributing+to+rubyXL">Contributing to rubyXL<span><a href="#label-Contributing+to+rubyXL">&para;</a> <a href="#documentation">&uarr;</a></span></h2>
370
+ <ul><li>
371
+ <p>Check out the latest master to make sure the feature hasn’t been
372
+ implemented or the bug hasn’t been fixed yet</p>
373
+ </li><li>
374
+ <p>Check out the issue tracker to make sure someone already hasn’t requested
375
+ it and/or contributed it</p>
376
+ </li><li>
377
+ <p>Fork the project</p>
378
+ </li><li>
379
+ <p>Start a feature/bugfix branch</p>
380
+ </li><li>
381
+ <p>Commit and push until you are happy with your contribution</p>
382
+ </li><li>
383
+ <p>Make sure to add tests for it. This is important so I don’t break it in a
384
+ future version unintentionally.</p>
385
+ </li><li>
386
+ <p>Please try not to mess with the Rakefile, version, or history. If you want
387
+ to have your own version, or is otherwise necessary, that is fine, but
388
+ please isolate to its own commit so I can cherry-pick around it.</p>
389
+ </li></ul>
390
+
391
+ <h2 id="label-Copyright">Copyright<span><a href="#label-Copyright">&para;</a> <a href="#documentation">&uarr;</a></span></h2>
392
+
393
+ <p>Copyright © 2011 Vivek Bhagwat, 2013-2014 Wesha. See LICENSE.txt for
394
+ further details.</p>
395
+ </main>
396
+
397
+
398
+
399
+ <footer id="validator-badges" role="contentinfo">
400
+ <p><a href="http://validator.w3.org/check/referer">Validate</a>
401
+ <p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.1.
402
+ <p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
403
+ </footer>
404
+