rubyXL 2.3.4 → 2.4.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 (250) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/lib/rubyXL.rb +2 -0
  4. data/lib/rubyXL/objects/calculation_chain.rb +6 -1
  5. data/lib/rubyXL/objects/chartsheet.rb +7 -1
  6. data/lib/rubyXL/objects/container_nodes.rb +6 -1
  7. data/lib/rubyXL/objects/content_types.rb +95 -0
  8. data/lib/rubyXL/objects/document_properties.rb +77 -1
  9. data/lib/rubyXL/objects/ooxml_object.rb +11 -7
  10. data/lib/rubyXL/objects/relationships.rb +9 -5
  11. data/lib/rubyXL/objects/shared_strings.rb +5 -1
  12. data/lib/rubyXL/objects/simple_types.rb +35 -1
  13. data/lib/rubyXL/objects/stylesheet.rb +5 -1
  14. data/lib/rubyXL/objects/theme.rb +471 -6
  15. data/lib/rubyXL/objects/workbook.rb +52 -1
  16. data/lib/rubyXL/objects/worksheet.rb +7 -1
  17. data/lib/rubyXL/parser.rb +9 -14
  18. data/lib/rubyXL/workbook.rb +11 -13
  19. data/rdoc/README_rdoc.html +1 -1
  20. data/rdoc/RubyXL.html +11 -1
  21. data/rdoc/RubyXL/AExtension.html +225 -0
  22. data/rdoc/RubyXL/AExtensionStorageArea.html +1 -1
  23. data/rdoc/RubyXL/Alignment.html +1 -1
  24. data/rdoc/RubyXL/AlternateContent.html +1 -1
  25. data/rdoc/RubyXL/AutoFilter.html +1 -1
  26. data/rdoc/RubyXL/AutoFilterColumn.html +1 -1
  27. data/rdoc/RubyXL/BooleanNode.html +1 -1
  28. data/rdoc/RubyXL/BooleanValue.html +1 -1
  29. data/rdoc/RubyXL/Border.html +1 -1
  30. data/rdoc/RubyXL/BorderEdge.html +1 -1
  31. data/rdoc/RubyXL/Borders.html +1 -1
  32. data/rdoc/RubyXL/Break.html +1 -1
  33. data/rdoc/RubyXL/BreakList.html +1 -1
  34. data/rdoc/RubyXL/CalculationChain.html +41 -6
  35. data/rdoc/RubyXL/CalculationChainCell.html +1 -1
  36. data/rdoc/RubyXL/CalculationProperties.html +1 -1
  37. data/rdoc/RubyXL/Cell.html +1 -1
  38. data/rdoc/RubyXL/CellSmartTag.html +1 -1
  39. data/rdoc/RubyXL/CellSmartTagProperty.html +1 -1
  40. data/rdoc/RubyXL/CellSmartTags.html +1 -1
  41. data/rdoc/RubyXL/CellStyle.html +1 -1
  42. data/rdoc/RubyXL/CellStyleXFs.html +1 -1
  43. data/rdoc/RubyXL/CellStyles.html +1 -1
  44. data/rdoc/RubyXL/CellValue.html +1 -1
  45. data/rdoc/RubyXL/CellWatch.html +1 -1
  46. data/rdoc/RubyXL/CellWatches.html +1 -1
  47. data/rdoc/RubyXL/CellXFs.html +1 -1
  48. data/rdoc/RubyXL/Chartsheet.html +1 -1
  49. data/rdoc/RubyXL/ChartsheetPageSetup.html +1 -1
  50. data/rdoc/RubyXL/ChartsheetProperties.html +1 -1
  51. data/rdoc/RubyXL/ChartsheetProtection.html +1 -1
  52. data/rdoc/RubyXL/ChartsheetView.html +1 -1
  53. data/rdoc/RubyXL/ChartsheetViews.html +1 -1
  54. data/rdoc/RubyXL/Color.html +1 -1
  55. data/rdoc/RubyXL/ColorFilter.html +1 -1
  56. data/rdoc/RubyXL/ColorScale.html +1 -1
  57. data/rdoc/RubyXL/ColorScheme.html +1 -1
  58. data/rdoc/RubyXL/ColorSet.html +1 -1
  59. data/rdoc/RubyXL/Colors.html +1 -1
  60. data/rdoc/RubyXL/ColumnRange.html +1 -1
  61. data/rdoc/RubyXL/ColumnRanges.html +1 -1
  62. data/rdoc/RubyXL/ConditionalFormatValue.html +1 -1
  63. data/rdoc/RubyXL/ConditionalFormatting.html +1 -1
  64. data/rdoc/RubyXL/ConditionalFormattingRule.html +1 -1
  65. data/rdoc/RubyXL/ContentTypeDefault.html +105 -0
  66. data/rdoc/RubyXL/ContentTypeOverride.html +105 -0
  67. data/rdoc/RubyXL/ContentTypes.html +310 -0
  68. data/rdoc/RubyXL/CoreProperties.html +105 -0
  69. data/rdoc/RubyXL/CustomColor.html +105 -0
  70. data/rdoc/RubyXL/CustomColorList.html +105 -0
  71. data/rdoc/RubyXL/CustomFilter.html +1 -1
  72. data/rdoc/RubyXL/CustomFilters.html +1 -1
  73. data/rdoc/RubyXL/CustomGeometry.html +105 -0
  74. data/rdoc/RubyXL/CustomProperties.html +1 -1
  75. data/rdoc/RubyXL/CustomProperty.html +1 -1
  76. data/rdoc/RubyXL/CustomSheetView.html +1 -1
  77. data/rdoc/RubyXL/CustomSheetViews.html +1 -1
  78. data/rdoc/RubyXL/CustomWorkbookView.html +1 -1
  79. data/rdoc/RubyXL/CustomWorkbookViews.html +1 -1
  80. data/rdoc/RubyXL/DXF.html +1 -1
  81. data/rdoc/RubyXL/DXFs.html +1 -1
  82. data/rdoc/RubyXL/DataBar.html +1 -1
  83. data/rdoc/RubyXL/DataConsolidate.html +1 -1
  84. data/rdoc/RubyXL/DataConsolidationReference.html +1 -1
  85. data/rdoc/RubyXL/DataConsolidationReferences.html +1 -1
  86. data/rdoc/RubyXL/DataValidation.html +1 -1
  87. data/rdoc/RubyXL/DataValidations.html +1 -1
  88. data/rdoc/RubyXL/DateGroupItem.html +1 -1
  89. data/rdoc/RubyXL/DefinedName.html +1 -1
  90. data/rdoc/RubyXL/DefinedNames.html +1 -1
  91. data/rdoc/RubyXL/DocumentProperties.html +41 -6
  92. data/rdoc/RubyXL/DynamicFilter.html +1 -1
  93. data/rdoc/RubyXL/EmbeddedControl.html +1 -1
  94. data/rdoc/RubyXL/EmbeddedControls.html +1 -1
  95. data/rdoc/RubyXL/Extension.html +1 -121
  96. data/rdoc/RubyXL/ExtensionStorageArea.html +1 -1
  97. data/rdoc/RubyXL/Extents.html +105 -0
  98. data/rdoc/RubyXL/ExternalReference.html +1 -1
  99. data/rdoc/RubyXL/ExternalReferences.html +1 -1
  100. data/rdoc/RubyXL/ExtraColorScheme.html +105 -0
  101. data/rdoc/RubyXL/ExtraColorSchemeList.html +105 -0
  102. data/rdoc/RubyXL/FieldItem.html +1 -1
  103. data/rdoc/RubyXL/FileRecoveryProperties.html +1 -1
  104. data/rdoc/RubyXL/FileSharing.html +1 -1
  105. data/rdoc/RubyXL/FileVersion.html +1 -1
  106. data/rdoc/RubyXL/Fill.html +1 -1
  107. data/rdoc/RubyXL/Fills.html +1 -1
  108. data/rdoc/RubyXL/FilterContainer.html +1 -1
  109. data/rdoc/RubyXL/FloatNode.html +1 -1
  110. data/rdoc/RubyXL/FloatValue.html +1 -1
  111. data/rdoc/RubyXL/Font.html +1 -1
  112. data/rdoc/RubyXL/FontScheme.html +1 -1
  113. data/rdoc/RubyXL/Fonts.html +1 -1
  114. data/rdoc/RubyXL/FormatScheme.html +1 -1
  115. data/rdoc/RubyXL/Formula.html +1 -1
  116. data/rdoc/RubyXL/FunctionGroup.html +1 -1
  117. data/rdoc/RubyXL/FunctionGroups.html +1 -1
  118. data/rdoc/RubyXL/GenericStorage.html +1 -1
  119. data/rdoc/RubyXL/GradientFill.html +1 -1
  120. data/rdoc/RubyXL/HeaderFooterSettings.html +1 -1
  121. data/rdoc/RubyXL/Hyperlink.html +1 -1
  122. data/rdoc/RubyXL/Hyperlinks.html +1 -1
  123. data/rdoc/RubyXL/IconFilter.html +1 -1
  124. data/rdoc/RubyXL/IconSet.html +1 -1
  125. data/rdoc/RubyXL/IgnoredError.html +1 -1
  126. data/rdoc/RubyXL/IgnoredErrors.html +1 -1
  127. data/rdoc/RubyXL/IndexedColors.html +1 -1
  128. data/rdoc/RubyXL/InputCells.html +1 -1
  129. data/rdoc/RubyXL/IntegerNode.html +1 -1
  130. data/rdoc/RubyXL/IntegerValue.html +1 -1
  131. data/rdoc/RubyXL/LegacyCell.html +1 -1
  132. data/rdoc/RubyXL/LegacyWorkbook.html +33 -55
  133. data/rdoc/RubyXL/LegacyWorksheet.html +1 -1
  134. data/rdoc/RubyXL/MRUColors.html +1 -1
  135. data/rdoc/RubyXL/MergedCell.html +1 -1
  136. data/rdoc/RubyXL/MergedCells.html +1 -1
  137. data/rdoc/RubyXL/NumFmt.html +1 -1
  138. data/rdoc/RubyXL/NumberFormat.html +1 -1
  139. data/rdoc/RubyXL/NumberFormats.html +1 -1
  140. data/rdoc/RubyXL/OLEObject.html +1 -1
  141. data/rdoc/RubyXL/OLEObjects.html +1 -1
  142. data/rdoc/RubyXL/OLESize.html +1 -1
  143. data/rdoc/RubyXL/OOXMLContainerObject.html +1 -1
  144. data/rdoc/RubyXL/OOXMLObject.html +1 -1
  145. data/rdoc/RubyXL/OOXMLObjectClassMethods.html +1 -1
  146. data/rdoc/RubyXL/OOXMLObjectInstanceMethods.html +1 -1
  147. data/rdoc/RubyXL/OOXMLRelationshipsFile.html +36 -1
  148. data/rdoc/RubyXL/OOXMLTopLevelObject.html +1 -1
  149. data/rdoc/RubyXL/ObjectDefaults.html +105 -0
  150. data/rdoc/RubyXL/Offset.html +105 -0
  151. data/rdoc/RubyXL/OutlineProperties.html +1 -1
  152. data/rdoc/RubyXL/PageMargins.html +1 -1
  153. data/rdoc/RubyXL/PageSetup.html +1 -1
  154. data/rdoc/RubyXL/PageSetupProperties.html +1 -1
  155. data/rdoc/RubyXL/Pane.html +1 -1
  156. data/rdoc/RubyXL/Parser.html +9 -14
  157. data/rdoc/RubyXL/PatternFill.html +1 -1
  158. data/rdoc/RubyXL/PhoneticProperties.html +1 -1
  159. data/rdoc/RubyXL/PhoneticRun.html +1 -1
  160. data/rdoc/RubyXL/PivotArea.html +1 -1
  161. data/rdoc/RubyXL/PivotCache.html +1 -1
  162. data/rdoc/RubyXL/PivotCaches.html +1 -1
  163. data/rdoc/RubyXL/PivotReference.html +1 -1
  164. data/rdoc/RubyXL/PivotReferences.html +1 -1
  165. data/rdoc/RubyXL/PivotTableSelection.html +1 -1
  166. data/rdoc/RubyXL/PresetGeometry.html +105 -0
  167. data/rdoc/RubyXL/PrintOptions.html +1 -1
  168. data/rdoc/RubyXL/ProtectedRange.html +1 -1
  169. data/rdoc/RubyXL/ProtectedRanges.html +1 -1
  170. data/rdoc/RubyXL/Protection.html +1 -1
  171. data/rdoc/RubyXL/RID.html +1 -1
  172. data/rdoc/RubyXL/RawOOXML.html +1 -1
  173. data/rdoc/RubyXL/Reference.html +1 -1
  174. data/rdoc/RubyXL/Relationship.html +1 -1
  175. data/rdoc/RubyXL/RichText.html +1 -1
  176. data/rdoc/RubyXL/RichTextRun.html +1 -1
  177. data/rdoc/RubyXL/RootRelationships.html +1 -1
  178. data/rdoc/RubyXL/Row.html +1 -1
  179. data/rdoc/RubyXL/RunProperties.html +1 -1
  180. data/rdoc/RubyXL/Scenario.html +1 -1
  181. data/rdoc/RubyXL/Scenarios.html +1 -1
  182. data/rdoc/RubyXL/Selection.html +1 -1
  183. data/rdoc/RubyXL/ShapeDefault.html +105 -0
  184. data/rdoc/RubyXL/SharedStringsTable.html +43 -8
  185. data/rdoc/RubyXL/Sheet.html +1 -1
  186. data/rdoc/RubyXL/SheetCalculationProperties.html +1 -1
  187. data/rdoc/RubyXL/SheetData.html +1 -1
  188. data/rdoc/RubyXL/Sheets.html +1 -1
  189. data/rdoc/RubyXL/SmartTagProperties.html +1 -1
  190. data/rdoc/RubyXL/SmartTagType.html +1 -1
  191. data/rdoc/RubyXL/SmartTagTypes.html +1 -1
  192. data/rdoc/RubyXL/SmartTags.html +1 -1
  193. data/rdoc/RubyXL/SortCondition.html +1 -1
  194. data/rdoc/RubyXL/SortState.html +1 -1
  195. data/rdoc/RubyXL/Sqref.html +1 -1
  196. data/rdoc/RubyXL/Stop.html +1 -1
  197. data/rdoc/RubyXL/StringNode.html +1 -1
  198. data/rdoc/RubyXL/{Writer.html → StringNodeW3C.html} +13 -6
  199. data/rdoc/RubyXL/StringValue.html +1 -1
  200. data/rdoc/RubyXL/Stylesheet.html +1 -1
  201. data/rdoc/RubyXL/TableParts.html +1 -1
  202. data/rdoc/RubyXL/TableStyle.html +1 -1
  203. data/rdoc/RubyXL/TableStyles.html +1 -1
  204. data/rdoc/RubyXL/Text.html +1 -1
  205. data/rdoc/RubyXL/Theme.html +2 -2
  206. data/rdoc/RubyXL/ThemeElements.html +1 -1
  207. data/rdoc/RubyXL/Top10.html +1 -1
  208. data/rdoc/RubyXL/TwoDTransform.html +105 -0
  209. data/rdoc/RubyXL/Variant.html +1 -1
  210. data/rdoc/RubyXL/Vector.html +1 -1
  211. data/rdoc/RubyXL/VectorValue.html +1 -1
  212. data/rdoc/RubyXL/VisualProperties.html +105 -0
  213. data/rdoc/RubyXL/WebPublishObject.html +1 -1
  214. data/rdoc/RubyXL/WebPublishObjects.html +1 -1
  215. data/rdoc/RubyXL/WebPublishingItem.html +1 -1
  216. data/rdoc/RubyXL/WebPublishingItems.html +1 -1
  217. data/rdoc/RubyXL/WebPublishingProperties.html +1 -1
  218. data/rdoc/RubyXL/Workbook.html +1 -1
  219. data/rdoc/RubyXL/WorkbookProperties.html +1 -1
  220. data/rdoc/RubyXL/WorkbookProtection.html +1 -1
  221. data/rdoc/RubyXL/WorkbookRelationships.html +1 -1
  222. data/rdoc/RubyXL/WorkbookView.html +1 -1
  223. data/rdoc/RubyXL/WorkbookViews.html +1 -1
  224. data/rdoc/RubyXL/Worksheet.html +1 -1
  225. data/rdoc/RubyXL/WorksheetDimensions.html +1 -1
  226. data/rdoc/RubyXL/WorksheetFormatProperties.html +1 -1
  227. data/rdoc/RubyXL/WorksheetProperties.html +1 -1
  228. data/rdoc/RubyXL/WorksheetProtection.html +1 -1
  229. data/rdoc/RubyXL/WorksheetView.html +1 -1
  230. data/rdoc/RubyXL/WorksheetViews.html +1 -1
  231. data/rdoc/RubyXL/XF.html +1 -1
  232. data/rdoc/created.rid +19 -24
  233. data/rdoc/index.html +12 -16
  234. data/rdoc/js/search_index.js +1 -1
  235. data/rdoc/table_of_contents.html +102 -153
  236. data/rubyXL.gemspec +22 -16
  237. data/spec/lib/parser_spec.rb +16 -2
  238. metadata +21 -15
  239. data/lib/rubyXL/writer/content_types_writer.rb +0 -113
  240. data/lib/rubyXL/writer/core_writer.rb +0 -34
  241. data/lib/rubyXL/writer/generic_writer.rb +0 -43
  242. data/lib/rubyXL/writer/styles_writer.rb +0 -15
  243. data/lib/rubyXL/writer/theme_writer.rb +0 -337
  244. data/lib/rubyXL/writer/workbook_writer.rb +0 -73
  245. data/rdoc/RubyXL/Writer/ContentTypesWriter.html +0 -289
  246. data/rdoc/RubyXL/Writer/CoreWriter.html +0 -210
  247. data/rdoc/RubyXL/Writer/GenericWriter.html +0 -348
  248. data/rdoc/RubyXL/Writer/StylesWriter.html +0 -191
  249. data/rdoc/RubyXL/Writer/ThemeWriter.html +0 -511
  250. data/rdoc/RubyXL/Writer/WorkbookWriter.html +0 -249
@@ -290,6 +290,7 @@ module RubyXL
290
290
  define_child_node(RubyXL::FileVersion)
291
291
  define_child_node(RubyXL::FileSharing)
292
292
  define_child_node(RubyXL::WorkbookProperties, :accessor => :workbook_properties)
293
+ define_child_node(RubyXL::AlternateContent) # Somehow, order matters here
293
294
  define_child_node(RubyXL::WorkbookProtection)
294
295
  define_child_node(RubyXL::WorkbookViews)
295
296
  define_child_node(RubyXL::Sheets)
@@ -306,7 +307,6 @@ module RubyXL
306
307
  define_child_node(RubyXL::FileRecoveryProperties)
307
308
  define_child_node(RubyXL::WebPublishObjects)
308
309
  define_child_node(RubyXL::ExtensionStorageArea)
309
- define_child_node(RubyXL::AlternateContent)
310
310
 
311
311
  define_element_name 'workbook'
312
312
  set_namespaces('xmlns' => 'http://schemas.openxmlformats.org/spreadsheetml/2006/main',
@@ -314,6 +314,17 @@ module RubyXL
314
314
  'xmlns:mc' => 'http://schemas.openxmlformats.org/markup-compatibility/2006',
315
315
  'xmlns:x15' => 'http://schemas.microsoft.com/office/spreadsheetml/2010/11/main')
316
316
 
317
+ def before_write_xml
318
+ self.sheets = RubyXL::Sheets.new
319
+
320
+ worksheets.each_with_index { |sheet, i|
321
+ rel = relationship_container.find_by_target(sheet.xlsx_path.gsub(/^xl\//, ''))
322
+ sheets << RubyXL::Sheet.new(:name => sheet.sheet_name, :sheet_id => sheet.sheet_id || (i + 1),
323
+ :state => sheet.state, :r_id => rel.id)
324
+ }
325
+ true
326
+ end
327
+
317
328
  include LegacyWorkbook
318
329
 
319
330
  def date1904
@@ -352,6 +363,46 @@ module RubyXL
352
363
  self.document_properties.app_version.value = v
353
364
  end
354
365
 
366
+ def creator
367
+ self.core_properties.creator
368
+ end
369
+
370
+ def creator=(v)
371
+ self.core_properties.creator = v
372
+ end
373
+
374
+ def modifier
375
+ self.core_properties.modifier
376
+ end
377
+
378
+ def modifier=(v)
379
+ self.core_properties.modifier = v
380
+ end
381
+
382
+ def created_at
383
+ self.core_properties.created_at
384
+ end
385
+
386
+ def created_at=(v)
387
+ self.core_properties.created_at = v
388
+ end
389
+
390
+ def modified_at
391
+ self.core_properties.modified_at
392
+ end
393
+
394
+ def modified_at=(v)
395
+ self.core_properties.modified_at = v
396
+ end
397
+
398
+ def self.xlsx_path
399
+ File.join('xl', 'workbook.xml')
400
+ end
401
+
402
+ def self.content_type
403
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml'
404
+ end
405
+
355
406
  end
356
407
 
357
408
  end
@@ -652,6 +652,8 @@ module RubyXL
652
652
  'xmlns:x14ac' => 'http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac',
653
653
  'xmlns:mv' => 'urn:schemas-microsoft-com:mac:vml')
654
654
 
655
+ attr_accessor :state
656
+
655
657
  def before_write_xml # This method may need to be moved higher in the hierarchy
656
658
  first_nonempty_row = nil
657
659
  last_nonempty_row = 0
@@ -701,10 +703,14 @@ module RubyXL
701
703
  @workbook.worksheets.select{ |sheet| sheet.is_a?(self.class) }.index{ |sheet| sheet.equal?(self) }
702
704
  end
703
705
 
704
- def filepath
706
+ def xlsx_path
705
707
  File.join('xl', 'worksheets', "sheet#{sheet_index + 1}.xml")
706
708
  end
707
709
 
710
+ def self.content_type
711
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml'
712
+ end
713
+
708
714
  def rel_type
709
715
  'worksheet'
710
716
  end
data/lib/rubyXL/parser.rb CHANGED
@@ -1,6 +1,6 @@
1
- require 'rubygems'
2
1
  require 'nokogiri'
3
2
  require 'tmpdir'
3
+ require 'zip'
4
4
  require 'rubyXL/generic_storage'
5
5
 
6
6
  module RubyXL
@@ -36,11 +36,10 @@ module RubyXL
36
36
  }
37
37
  }
38
38
 
39
- workbook_file = Nokogiri::XML.parse(File.open(File.join(dir_path, 'xl', 'workbook.xml'), 'r'))
40
-
41
- wb = RubyXL::Workbook.parse(workbook_file)
39
+ wb = RubyXL::Workbook.parse_file(dir_path)
42
40
  wb.filepath = xl_file_path
43
41
 
42
+ wb.content_types = RubyXL::ContentTypes.parse_file(dir_path)
44
43
  wb.relationship_container = RubyXL::WorkbookRelationships.parse_file(dir_path)
45
44
  wb.root_relationship_container = RubyXL::RootRelationships.parse_file(dir_path)
46
45
 
@@ -56,14 +55,9 @@ module RubyXL
56
55
  wb.worksheet_rels.load_dir(dir_path)
57
56
  wb.chartsheet_rels.load_dir(dir_path)
58
57
  wb.macros.load_file(dir_path, 'vbaProject.bin')
59
- wb.theme.load_file(dir_path, 'theme1.xml')
60
-
61
- core_file = Nokogiri::XML.parse(File.open(File.join(dir_path, 'docProps', 'core.xml'), 'r'))
62
- wb.creator = core_file.css('dc|creator').children.to_s
63
- wb.modifier = core_file.css('cp|last_modified_by').children.to_s
64
- wb.created_at = core_file.css('dcterms|created').children.to_s
65
- wb.modified_at = core_file.css('dcterms|modified').children.to_s
66
58
 
59
+ wb.theme = RubyXL::Theme.parse_file(dir_path)
60
+ wb.core_properties = RubyXL::CoreProperties.parse_file(dir_path)
67
61
  wb.document_properties = RubyXL::DocumentProperties.parse_file(dir_path)
68
62
  wb.calculation_chain = RubyXL::CalculationChain.parse_file(dir_path)
69
63
  end
@@ -86,23 +80,24 @@ module RubyXL
86
80
  wb.sheets.each_with_index { |sheet, i|
87
81
  sheet_rel = wb.relationship_container.find_by_rid(sheet.r_id)
88
82
 
89
- sheet_file_path = sheet_rel.target
83
+ sheet_file = File.open(File.join(dir_path, 'xl', sheet_rel.target))
90
84
 
91
85
  case File::basename(sheet_rel.type)
92
86
  when 'worksheet' then
93
- sheet_obj = RubyXL::Worksheet.parse(File.open(File.join(dir_path, 'xl', sheet_file_path)))
87
+ sheet_obj = RubyXL::Worksheet.parse(sheet_file)
94
88
  sheet_obj.sheet_data.rows.each { |r|
95
89
  next if r.nil?
96
90
  r.worksheet = sheet
97
91
  r.cells.each { |c| c.worksheet = sheet_obj unless c.nil? }
98
92
  }
99
93
  when 'chartsheet' then
100
- sheet_obj = RubyXL::Chartsheet.parse(File.open(File.join(dir_path, 'xl', sheet_file_path)))
94
+ sheet_obj = RubyXL::Chartsheet.parse(sheet_file)
101
95
  end
102
96
 
103
97
  sheet_obj.workbook = wb
104
98
  sheet_obj.sheet_name = sheet.name
105
99
  sheet_obj.sheet_id = sheet.sheet_id
100
+ sheet_obj.state = sheet.state
106
101
 
107
102
  wb.worksheets[i] = sheet_obj
108
103
  }
@@ -1,21 +1,15 @@
1
- require 'rubyXL/writer/generic_writer'
2
- require 'rubyXL/writer/content_types_writer'
3
- require 'rubyXL/writer/core_writer'
4
- require 'rubyXL/writer/theme_writer'
5
- require 'rubyXL/writer/workbook_writer'
6
- require 'rubyXL/writer/styles_writer'
7
1
  require 'tmpdir'
8
2
  require 'zip'
9
3
 
10
4
  module RubyXL
11
5
  module LegacyWorkbook
12
6
  include Enumerable
13
- attr_accessor :worksheets, :filepath, :creator, :modifier, :created_at, :modified_at, :theme,
7
+ attr_accessor :worksheets, :filepath, :theme,
14
8
  :media, :external_links, :external_links_rels, :drawings, :drawings_rels, :charts, :chart_rels,
15
9
  :worksheet_rels, :chartsheet_rels, :printer_settings, :macros
16
10
 
17
11
  attr_accessor :stylesheet, :shared_strings_container, :document_properties, :calculation_chain,
18
- :relationship_container, :root_relationship_container
12
+ :relationship_container, :root_relationship_container, :core_properties, :content_types
19
13
 
20
14
  SHEET_NAME_TEMPLATE = 'Sheet%d'
21
15
  APPLICATION = 'Microsoft Macintosh Excel'
@@ -44,13 +38,15 @@ module RubyXL
44
38
  @chart_rels = RubyXL::GenericStorage.new(File.join('xl', 'charts', '_rels'))
45
39
  @worksheet_rels = RubyXL::GenericStorage.new(File.join('xl', 'worksheets', '_rels'))
46
40
  @chartsheet_rels = RubyXL::GenericStorage.new(File.join('xl', 'chartsheets', '_rels'))
47
- @theme = RubyXL::GenericStorage.new(File.join('xl', 'theme'))
48
41
  @printer_settings = RubyXL::GenericStorage.new(File.join('xl', 'printerSettings')).binary
49
42
  @macros = RubyXL::GenericStorage.new('xl').binary
50
43
 
44
+ @theme = RubyXL::Theme.new
51
45
  @shared_strings_container = RubyXL::SharedStringsTable.new
52
46
  @stylesheet = RubyXL::Stylesheet.default
53
47
  @document_properties = RubyXL::DocumentProperties.new
48
+ @core_properties = RubyXL::CoreProperties.new
49
+ @content_types = RubyXL::ContentTypes.new
54
50
  @relationship_container = RubyXL::WorkbookRelationships.new
55
51
  @root_relationship_container = RubyXL::RootRelationships.new
56
52
  @calculation_chain = nil
@@ -109,16 +105,18 @@ module RubyXL
109
105
  zippath = File.join(temppath, 'file.zip')
110
106
 
111
107
  ::Zip::File.open(zippath, ::Zip::File::CREATE) { |zipfile|
112
- [ Writer::ContentTypesWriter, Writer::CoreWriter,
113
- Writer::ThemeWriter, Writer::WorkbookWriter, Writer::StylesWriter
114
- ].each { |writer_class| writer_class.new(self).add_to_zip(zipfile) }
115
-
108
+ theme && theme.add_to_zip(zipfile)
116
109
  calculation_chain && calculation_chain.add_to_zip(zipfile)
117
110
  shared_strings_container && shared_strings_container.add_to_zip(zipfile)
118
111
  document_properties.add_to_zip(zipfile)
112
+ core_properties.add_to_zip(zipfile)
113
+ content_types.workbook = self
114
+ content_types.add_to_zip(zipfile)
119
115
  relationship_container.workbook = self
120
116
  relationship_container.add_to_zip(zipfile)
117
+ stylesheet.add_to_zip(zipfile)
121
118
  root_relationship_container.add_to_zip(zipfile)
119
+ self.add_to_zip(zipfile)
122
120
 
123
121
  [ @media, @external_links, @external_links_rels,
124
122
  @drawings, @drawings_rels, @charts, @chart_rels,
@@ -4,7 +4,7 @@
4
4
  <head>
5
5
  <meta charset="UTF-8">
6
6
 
7
- <title>README - rubyXL 2.3.4</title>
7
+ <title>README - rubyXL 2.4.0</title>
8
8
 
9
9
  <link href="./fonts.css" rel="stylesheet">
10
10
  <link href="./rdoc.css" rel="stylesheet">
data/rdoc/RubyXL.html CHANGED
@@ -4,7 +4,7 @@
4
4
  <head>
5
5
  <meta charset="UTF-8">
6
6
 
7
- <title>module RubyXL - rubyXL 2.3.4</title>
7
+ <title>module RubyXL - rubyXL 2.4.0</title>
8
8
 
9
9
  <link href="./fonts.css" rel="stylesheet">
10
10
  <link href="./rdoc.css" rel="stylesheet">
@@ -93,6 +93,11 @@
93
93
  <dd>
94
94
 
95
95
 
96
+ <dt id="ST_BlackWhiteMode">ST_BlackWhiteMode
97
+
98
+ <dd>
99
+
100
+
96
101
  <dt id="ST_BorderStyle">ST_BorderStyle
97
102
 
98
103
  <dd>
@@ -263,6 +268,11 @@
263
268
  <dd>
264
269
 
265
270
 
271
+ <dt id="ST_ShapeType">ST_ShapeType
272
+
273
+ <dd>
274
+
275
+
266
276
  <dt id="ST_SheetViewType">ST_SheetViewType
267
277
 
268
278
  <dd>
@@ -0,0 +1,225 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta charset="UTF-8">
6
+
7
+ <title>class RubyXL::AExtension - rubyXL 2.4.0</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="class">
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
+
58
+ <div id="class-metadata">
59
+
60
+ <div id="parent-class-section" class="nav-section">
61
+ <h3>Parent</h3>
62
+
63
+
64
+ <p class="link"><a href="OOXMLObject.html">RubyXL::OOXMLObject</a>
65
+
66
+ </div>
67
+
68
+
69
+
70
+ <!-- Method Quickref -->
71
+ <div id="method-list-section" class="nav-section">
72
+ <h3>Methods</h3>
73
+
74
+ <ul class="link-list" role="directory">
75
+
76
+ <li ><a href="#method-c-parse">::parse</a>
77
+
78
+ <li ><a href="#method-i-write_xml">#write_xml</a>
79
+
80
+ </ul>
81
+ </div>
82
+
83
+ </div>
84
+ </nav>
85
+
86
+ <main role="main" aria-labelledby="class-RubyXL::AExtension">
87
+ <h1 id="class-RubyXL::AExtension" class="class">
88
+ class RubyXL::AExtension
89
+ </h1>
90
+
91
+ <section class="description">
92
+
93
+ <p><a
94
+ href="http://www.schemacentral.com/sc/ooxml/e-a_ext-1.html">www.schemacentral.com/sc/ooxml/e-a_ext-1.html</a></p>
95
+
96
+ </section>
97
+
98
+
99
+
100
+
101
+ <section id="5Buntitled-5D" class="documentation-section">
102
+
103
+
104
+
105
+
106
+
107
+
108
+
109
+ <section class="attribute-method-details" class="method-section">
110
+ <header>
111
+ <h3>Attributes</h3>
112
+ </header>
113
+
114
+
115
+ <div id="attribute-i-raw_xml" class="method-detail">
116
+ <div class="method-heading attribute-method-heading">
117
+ <span class="method-name">raw_xml</span><span
118
+ class="attribute-access-type">[RW]</span>
119
+ </div>
120
+
121
+ <div class="method-description">
122
+
123
+
124
+
125
+ </div>
126
+ </div>
127
+
128
+ </section>
129
+
130
+
131
+
132
+ <section id="public-class-5Buntitled-5D-method-details" class="method-section">
133
+ <header>
134
+ <h3>Public Class Methods</h3>
135
+ </header>
136
+
137
+
138
+ <div id="method-c-parse" class="method-detail ">
139
+
140
+ <div class="method-heading">
141
+ <span class="method-name">parse</span><span
142
+ class="method-args">(node)</span>
143
+
144
+ <span class="method-click-advice">click to toggle source</span>
145
+
146
+ </div>
147
+
148
+
149
+ <div class="method-description">
150
+
151
+
152
+
153
+
154
+
155
+
156
+ <div class="method-source-code" id="parse-source">
157
+ <pre><span class="ruby-comment"># File lib/rubyXL/objects/theme.rb, line 12</span>
158
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">node</span>)
159
+ <span class="ruby-identifier">obj</span> = <span class="ruby-identifier">new</span>
160
+ <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">raw_xml</span> = <span class="ruby-identifier">node</span>.<span class="ruby-identifier">to_xml</span>
161
+ <span class="ruby-identifier">obj</span>
162
+ <span class="ruby-keyword">end</span></pre>
163
+ </div>
164
+
165
+ </div>
166
+
167
+
168
+
169
+
170
+ </div>
171
+
172
+
173
+ </section>
174
+
175
+ <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
176
+ <header>
177
+ <h3>Public Instance Methods</h3>
178
+ </header>
179
+
180
+
181
+ <div id="method-i-write_xml" class="method-detail ">
182
+
183
+ <div class="method-heading">
184
+ <span class="method-name">write_xml</span><span
185
+ class="method-args">(xml, node_name_override = nil)</span>
186
+
187
+ <span class="method-click-advice">click to toggle source</span>
188
+
189
+ </div>
190
+
191
+
192
+ <div class="method-description">
193
+
194
+
195
+
196
+
197
+
198
+
199
+ <div class="method-source-code" id="write_xml-source">
200
+ <pre><span class="ruby-comment"># File lib/rubyXL/objects/theme.rb, line 18</span>
201
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">write_xml</span>(<span class="ruby-identifier">xml</span>, <span class="ruby-identifier">node_name_override</span> = <span class="ruby-keyword">nil</span>)
202
+ <span class="ruby-keyword">self</span>.<span class="ruby-identifier">raw_xml</span>
203
+ <span class="ruby-keyword">end</span></pre>
204
+ </div>
205
+
206
+ </div>
207
+
208
+
209
+
210
+
211
+ </div>
212
+
213
+
214
+ </section>
215
+
216
+ </section>
217
+ </main>
218
+
219
+
220
+ <footer id="validator-badges" role="contentinfo">
221
+ <p><a href="http://validator.w3.org/check/referer">Validate</a>
222
+ <p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.1.
223
+ <p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
224
+ </footer>
225
+