rubyXL 2.3.2 → 2.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (218) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +6 -6
  3. data/VERSION +1 -1
  4. data/lib/rubyXL/cell.rb +0 -10
  5. data/lib/rubyXL/objects/relationships.rb +46 -14
  6. data/lib/rubyXL/objects/sheet_data.rb +14 -2
  7. data/lib/rubyXL/parser.rb +1 -0
  8. data/lib/rubyXL/workbook.rb +7 -6
  9. data/rdoc/README_rdoc.html +27 -27
  10. data/rdoc/RubyXL/AExtensionStorageArea.html +1 -1
  11. data/rdoc/RubyXL/Alignment.html +1 -1
  12. data/rdoc/RubyXL/AlternateContent.html +1 -1
  13. data/rdoc/RubyXL/AutoFilter.html +1 -1
  14. data/rdoc/RubyXL/AutoFilterColumn.html +1 -1
  15. data/rdoc/RubyXL/BooleanNode.html +1 -1
  16. data/rdoc/RubyXL/BooleanValue.html +1 -1
  17. data/rdoc/RubyXL/Border.html +1 -1
  18. data/rdoc/RubyXL/BorderEdge.html +1 -1
  19. data/rdoc/RubyXL/Borders.html +1 -1
  20. data/rdoc/RubyXL/Break.html +1 -1
  21. data/rdoc/RubyXL/BreakList.html +1 -1
  22. data/rdoc/RubyXL/CalculationChain.html +2 -2
  23. data/rdoc/RubyXL/CalculationChainCell.html +1 -1
  24. data/rdoc/RubyXL/CalculationProperties.html +1 -1
  25. data/rdoc/RubyXL/Cell.html +78 -5
  26. data/rdoc/RubyXL/CellSmartTag.html +1 -1
  27. data/rdoc/RubyXL/CellSmartTagProperty.html +1 -1
  28. data/rdoc/RubyXL/CellSmartTags.html +1 -1
  29. data/rdoc/RubyXL/CellStyle.html +1 -1
  30. data/rdoc/RubyXL/CellStyleXFs.html +1 -1
  31. data/rdoc/RubyXL/CellStyles.html +1 -1
  32. data/rdoc/RubyXL/CellValue.html +1 -1
  33. data/rdoc/RubyXL/CellWatch.html +1 -1
  34. data/rdoc/RubyXL/CellWatches.html +1 -1
  35. data/rdoc/RubyXL/CellXFs.html +1 -1
  36. data/rdoc/RubyXL/Chartsheet.html +1 -1
  37. data/rdoc/RubyXL/ChartsheetPageSetup.html +1 -1
  38. data/rdoc/RubyXL/ChartsheetProperties.html +1 -1
  39. data/rdoc/RubyXL/ChartsheetProtection.html +1 -1
  40. data/rdoc/RubyXL/ChartsheetView.html +1 -1
  41. data/rdoc/RubyXL/ChartsheetViews.html +1 -1
  42. data/rdoc/RubyXL/Color.html +3 -3
  43. data/rdoc/RubyXL/ColorFilter.html +1 -1
  44. data/rdoc/RubyXL/ColorScale.html +1 -1
  45. data/rdoc/RubyXL/ColorScheme.html +1 -1
  46. data/rdoc/RubyXL/ColorSet.html +1 -1
  47. data/rdoc/RubyXL/Colors.html +1 -1
  48. data/rdoc/RubyXL/ColumnRange.html +1 -1
  49. data/rdoc/RubyXL/ColumnRanges.html +1 -1
  50. data/rdoc/RubyXL/ConditionalFormatValue.html +1 -1
  51. data/rdoc/RubyXL/ConditionalFormatting.html +1 -1
  52. data/rdoc/RubyXL/ConditionalFormattingRule.html +1 -1
  53. data/rdoc/RubyXL/CustomFilter.html +1 -1
  54. data/rdoc/RubyXL/CustomFilters.html +1 -1
  55. data/rdoc/RubyXL/CustomProperties.html +1 -1
  56. data/rdoc/RubyXL/CustomProperty.html +1 -1
  57. data/rdoc/RubyXL/CustomSheetView.html +1 -1
  58. data/rdoc/RubyXL/CustomSheetViews.html +1 -1
  59. data/rdoc/RubyXL/CustomWorkbookView.html +1 -1
  60. data/rdoc/RubyXL/CustomWorkbookViews.html +1 -1
  61. data/rdoc/RubyXL/DXF.html +1 -1
  62. data/rdoc/RubyXL/DXFs.html +1 -1
  63. data/rdoc/RubyXL/DataBar.html +1 -1
  64. data/rdoc/RubyXL/DataConsolidate.html +1 -1
  65. data/rdoc/RubyXL/DataConsolidationReference.html +1 -1
  66. data/rdoc/RubyXL/DataConsolidationReferences.html +1 -1
  67. data/rdoc/RubyXL/DataValidation.html +1 -1
  68. data/rdoc/RubyXL/DataValidations.html +1 -1
  69. data/rdoc/RubyXL/DateGroupItem.html +1 -1
  70. data/rdoc/RubyXL/DefinedName.html +1 -1
  71. data/rdoc/RubyXL/DefinedNames.html +1 -1
  72. data/rdoc/RubyXL/DocumentProperties.html +6 -6
  73. data/rdoc/RubyXL/DynamicFilter.html +1 -1
  74. data/rdoc/RubyXL/EmbeddedControl.html +1 -1
  75. data/rdoc/RubyXL/EmbeddedControls.html +1 -1
  76. data/rdoc/RubyXL/Extension.html +1 -1
  77. data/rdoc/RubyXL/ExtensionStorageArea.html +1 -1
  78. data/rdoc/RubyXL/ExternalReference.html +1 -1
  79. data/rdoc/RubyXL/ExternalReferences.html +1 -1
  80. data/rdoc/RubyXL/FieldItem.html +1 -1
  81. data/rdoc/RubyXL/FileRecoveryProperties.html +1 -1
  82. data/rdoc/RubyXL/FileSharing.html +1 -1
  83. data/rdoc/RubyXL/FileVersion.html +1 -1
  84. data/rdoc/RubyXL/Fill.html +1 -1
  85. data/rdoc/RubyXL/Fills.html +1 -1
  86. data/rdoc/RubyXL/FilterContainer.html +1 -1
  87. data/rdoc/RubyXL/FloatNode.html +1 -1
  88. data/rdoc/RubyXL/FloatValue.html +1 -1
  89. data/rdoc/RubyXL/Font.html +1 -1
  90. data/rdoc/RubyXL/FontScheme.html +1 -1
  91. data/rdoc/RubyXL/Fonts.html +1 -1
  92. data/rdoc/RubyXL/FormatScheme.html +1 -1
  93. data/rdoc/RubyXL/Formula.html +1 -1
  94. data/rdoc/RubyXL/FunctionGroup.html +1 -1
  95. data/rdoc/RubyXL/FunctionGroups.html +1 -1
  96. data/rdoc/RubyXL/GenericStorage.html +4 -4
  97. data/rdoc/RubyXL/GradientFill.html +1 -1
  98. data/rdoc/RubyXL/HeaderFooterSettings.html +1 -1
  99. data/rdoc/RubyXL/Hyperlink.html +1 -1
  100. data/rdoc/RubyXL/Hyperlinks.html +1 -1
  101. data/rdoc/RubyXL/IconFilter.html +1 -1
  102. data/rdoc/RubyXL/IconSet.html +1 -1
  103. data/rdoc/RubyXL/IgnoredError.html +1 -1
  104. data/rdoc/RubyXL/IgnoredErrors.html +1 -1
  105. data/rdoc/RubyXL/IndexedColors.html +1 -1
  106. data/rdoc/RubyXL/InputCells.html +1 -1
  107. data/rdoc/RubyXL/IntegerNode.html +1 -1
  108. data/rdoc/RubyXL/IntegerValue.html +1 -1
  109. data/rdoc/RubyXL/LegacyCell.html +57 -94
  110. data/rdoc/RubyXL/LegacyWorkbook.html +53 -38
  111. data/rdoc/RubyXL/LegacyWorksheet.html +29 -29
  112. data/rdoc/RubyXL/MRUColors.html +1 -1
  113. data/rdoc/RubyXL/MergedCell.html +1 -1
  114. data/rdoc/RubyXL/MergedCells.html +1 -1
  115. data/rdoc/RubyXL/NumFmt.html +1 -1
  116. data/rdoc/RubyXL/NumberFormat.html +2 -2
  117. data/rdoc/RubyXL/NumberFormats.html +1 -1
  118. data/rdoc/RubyXL/OLEObject.html +1 -1
  119. data/rdoc/RubyXL/OLEObjects.html +1 -1
  120. data/rdoc/RubyXL/OLESize.html +1 -1
  121. data/rdoc/RubyXL/OOXMLContainerObject.html +1 -1
  122. data/rdoc/RubyXL/OOXMLObject.html +1 -1
  123. data/rdoc/RubyXL/OOXMLObjectClassMethods.html +12 -12
  124. data/rdoc/RubyXL/OOXMLObjectInstanceMethods.html +1 -1
  125. data/rdoc/RubyXL/OOXMLRelationshipsFile.html +238 -0
  126. data/rdoc/RubyXL/OOXMLTopLevelObject.html +1 -1
  127. data/rdoc/RubyXL/OutlineProperties.html +1 -1
  128. data/rdoc/RubyXL/PageMargins.html +1 -1
  129. data/rdoc/RubyXL/PageSetup.html +1 -1
  130. data/rdoc/RubyXL/PageSetupProperties.html +1 -1
  131. data/rdoc/RubyXL/Pane.html +1 -1
  132. data/rdoc/RubyXL/Parser.html +16 -15
  133. data/rdoc/RubyXL/PatternFill.html +1 -1
  134. data/rdoc/RubyXL/PhoneticProperties.html +1 -1
  135. data/rdoc/RubyXL/PhoneticRun.html +1 -1
  136. data/rdoc/RubyXL/PivotArea.html +1 -1
  137. data/rdoc/RubyXL/PivotCache.html +1 -1
  138. data/rdoc/RubyXL/PivotCaches.html +1 -1
  139. data/rdoc/RubyXL/PivotReference.html +1 -1
  140. data/rdoc/RubyXL/PivotReferences.html +1 -1
  141. data/rdoc/RubyXL/PivotTableSelection.html +1 -1
  142. data/rdoc/RubyXL/PrintOptions.html +1 -1
  143. data/rdoc/RubyXL/ProtectedRange.html +1 -1
  144. data/rdoc/RubyXL/ProtectedRanges.html +1 -1
  145. data/rdoc/RubyXL/Protection.html +1 -1
  146. data/rdoc/RubyXL/RID.html +1 -1
  147. data/rdoc/RubyXL/RawOOXML.html +1 -1
  148. data/rdoc/RubyXL/Reference.html +5 -5
  149. data/rdoc/RubyXL/Relationship.html +1 -1
  150. data/rdoc/RubyXL/RichText.html +1 -1
  151. data/rdoc/RubyXL/RichTextRun.html +1 -1
  152. data/rdoc/RubyXL/RootRelationships.html +105 -0
  153. data/rdoc/RubyXL/Row.html +1 -1
  154. data/rdoc/RubyXL/RunProperties.html +1 -1
  155. data/rdoc/RubyXL/Scenario.html +1 -1
  156. data/rdoc/RubyXL/Scenarios.html +1 -1
  157. data/rdoc/RubyXL/Selection.html +1 -1
  158. data/rdoc/RubyXL/SharedStringsTable.html +2 -2
  159. data/rdoc/RubyXL/Sheet.html +1 -1
  160. data/rdoc/RubyXL/SheetCalculationProperties.html +1 -1
  161. data/rdoc/RubyXL/SheetData.html +1 -1
  162. data/rdoc/RubyXL/Sheets.html +1 -1
  163. data/rdoc/RubyXL/SmartTagProperties.html +1 -1
  164. data/rdoc/RubyXL/SmartTagType.html +1 -1
  165. data/rdoc/RubyXL/SmartTagTypes.html +1 -1
  166. data/rdoc/RubyXL/SmartTags.html +1 -1
  167. data/rdoc/RubyXL/SortCondition.html +1 -1
  168. data/rdoc/RubyXL/SortState.html +1 -1
  169. data/rdoc/RubyXL/Sqref.html +2 -2
  170. data/rdoc/RubyXL/Stop.html +1 -1
  171. data/rdoc/RubyXL/StringNode.html +1 -1
  172. data/rdoc/RubyXL/StringValue.html +1 -1
  173. data/rdoc/RubyXL/Stylesheet.html +1 -1
  174. data/rdoc/RubyXL/TableParts.html +1 -1
  175. data/rdoc/RubyXL/TableStyle.html +1 -1
  176. data/rdoc/RubyXL/TableStyles.html +1 -1
  177. data/rdoc/RubyXL/Text.html +2 -2
  178. data/rdoc/RubyXL/Theme.html +1 -1
  179. data/rdoc/RubyXL/ThemeElements.html +1 -1
  180. data/rdoc/RubyXL/Top10.html +1 -1
  181. data/rdoc/RubyXL/Variant.html +1 -1
  182. data/rdoc/RubyXL/Vector.html +1 -1
  183. data/rdoc/RubyXL/VectorValue.html +1 -1
  184. data/rdoc/RubyXL/WebPublishObject.html +1 -1
  185. data/rdoc/RubyXL/WebPublishObjects.html +1 -1
  186. data/rdoc/RubyXL/WebPublishingItem.html +1 -1
  187. data/rdoc/RubyXL/WebPublishingItems.html +1 -1
  188. data/rdoc/RubyXL/WebPublishingProperties.html +1 -1
  189. data/rdoc/RubyXL/Workbook.html +1 -1
  190. data/rdoc/RubyXL/WorkbookProperties.html +1 -1
  191. data/rdoc/RubyXL/WorkbookProtection.html +1 -1
  192. data/rdoc/RubyXL/WorkbookRelationships.html +2 -213
  193. data/rdoc/RubyXL/WorkbookView.html +1 -1
  194. data/rdoc/RubyXL/WorkbookViews.html +1 -1
  195. data/rdoc/RubyXL/Worksheet.html +1 -1
  196. data/rdoc/RubyXL/WorksheetDimensions.html +1 -1
  197. data/rdoc/RubyXL/WorksheetFormatProperties.html +1 -1
  198. data/rdoc/RubyXL/WorksheetProperties.html +1 -1
  199. data/rdoc/RubyXL/WorksheetProtection.html +1 -1
  200. data/rdoc/RubyXL/WorksheetView.html +1 -1
  201. data/rdoc/RubyXL/WorksheetViews.html +1 -1
  202. data/rdoc/RubyXL/Writer/ContentTypesWriter.html +53 -53
  203. data/rdoc/RubyXL/Writer/CoreWriter.html +12 -12
  204. data/rdoc/RubyXL/Writer/GenericWriter.html +5 -5
  205. data/rdoc/RubyXL/Writer/StylesWriter.html +2 -2
  206. data/rdoc/RubyXL/Writer/ThemeWriter.html +5 -5
  207. data/rdoc/RubyXL/Writer/WorkbookWriter.html +21 -21
  208. data/rdoc/RubyXL/Writer.html +1 -1
  209. data/rdoc/RubyXL/XF.html +1 -1
  210. data/rdoc/RubyXL.html +1 -1
  211. data/rdoc/created.rid +40 -41
  212. data/rdoc/index.html +4 -6
  213. data/rdoc/js/search_index.js +1 -1
  214. data/rdoc/table_of_contents.html +80 -93
  215. data/rubyXL.gemspec +5 -5
  216. metadata +4 -4
  217. data/lib/rubyXL/writer/root_rels_writer.rb +0 -17
  218. data/rdoc/RubyXL/Writer/RootRelsWriter.html +0 -193
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bb995632fe3bab317e7cccff7d9f640453bc4d0a
4
- data.tar.gz: cfac8e116d49fb6510f17b94377393a4ec86dbf8
3
+ metadata.gz: 393dc121135a64cb599f6e9fd210dc278313a77a
4
+ data.tar.gz: 11509287c9346cb333d9c7efd13d60e994291c03
5
5
  SHA512:
6
- metadata.gz: f6265e30720188367cc6143345a279b66fed50e3cc1d8c00747f3e15f240183a6c2d2161ef98dbec35b903cc18567f76ead04e8ce0678f19abe3bf7ff4d9194e
7
- data.tar.gz: b67c9ad46311b54135f2339e0f65ba40ce176ee376b8d09699cb3c7b823727f8aba58b974663a1896370cc7e1dbe12014796d67319360ccd10e20c12df712115
6
+ metadata.gz: f2106ad0876f295480e0e56e58d055e3347ea51ddd2938db5c4570d893ef363c7daf4eea3c958fdb70de43857717d43531611afcf8af4fb6e9320f73cba63065
7
+ data.tar.gz: c9dd7a1dbf16e970fe97741b8aa099155e052d98fe67dd68ba4b3325c66d98f6afc50c17f15ca8083b347a32976b6a16f517d42bcd0b1cf5a3e00d7921de3ef3
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- activesupport (4.0.2)
4
+ activesupport (4.0.3)
5
5
  i18n (~> 0.6, >= 0.6.4)
6
6
  minitest (~> 4.2)
7
7
  multi_json (~> 1.3)
@@ -12,7 +12,7 @@ GEM
12
12
  builder (3.2.2)
13
13
  descendants_tracker (0.0.3)
14
14
  diff-lcs (1.2.5)
15
- docile (1.1.1)
15
+ docile (1.1.3)
16
16
  faraday (0.9.0)
17
17
  multipart-post (>= 1.2, < 3)
18
18
  git (1.2.6)
@@ -41,7 +41,7 @@ GEM
41
41
  multi_json (>= 1.5)
42
42
  mini_portile (0.5.2)
43
43
  minitest (4.7.5)
44
- multi_json (1.8.2)
44
+ multi_json (1.8.4)
45
45
  multi_xml (0.5.5)
46
46
  multipart-post (2.0.0)
47
47
  nokogiri (1.6.1)
@@ -61,15 +61,15 @@ GEM
61
61
  rspec-expectations (~> 2.14.0)
62
62
  rspec-mocks (~> 2.14.0)
63
63
  rspec-core (2.14.7)
64
- rspec-expectations (2.14.4)
64
+ rspec-expectations (2.14.5)
65
65
  diff-lcs (>= 1.1.3, < 2.0)
66
- rspec-mocks (2.14.4)
66
+ rspec-mocks (2.14.5)
67
67
  rubyzip (1.1.0)
68
68
  shoulda (3.5.0)
69
69
  shoulda-context (~> 1.0, >= 1.0.1)
70
70
  shoulda-matchers (>= 1.4.1, < 3.0)
71
71
  shoulda-context (1.1.6)
72
- shoulda-matchers (2.4.0)
72
+ shoulda-matchers (2.5.0)
73
73
  activesupport (>= 3.0.0)
74
74
  simplecov (0.8.2)
75
75
  docile (~> 1.1.0)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.3.2
1
+ 2.3.3
data/lib/rubyXL/cell.rb CHANGED
@@ -10,12 +10,6 @@ module RubyXL
10
10
  @worksheet.workbook
11
11
  end
12
12
 
13
- def is_date?
14
- return false unless raw_value =~ /^\d+$/ # Only fully numeric values can be dates
15
- num_fmt = get_number_format
16
- num_fmt && num_fmt.is_date_format?
17
- end
18
-
19
13
  # changes fill color of cell
20
14
  def change_fill(rgb='ffffff')
21
15
  validate_worksheet
@@ -292,10 +286,6 @@ module RubyXL
292
286
  workbook.borders[get_cell_xf.border_id]
293
287
  end
294
288
 
295
- def get_number_format
296
- workbook.stylesheet.get_number_format_by_id(get_cell_xf.num_fmt_id)
297
- end
298
-
299
289
  end
300
290
  end
301
291
 
@@ -13,51 +13,83 @@ module RubyXL
13
13
  define_element_name 'Relationship'
14
14
  end
15
15
 
16
- # http://www.schemacentral.com/sc/ooxml/e-ssml_calcChain.html
17
- class WorkbookRelationships < OOXMLTopLevelObject
16
+ class OOXMLRelationshipsFile < OOXMLTopLevelObject
18
17
  define_child_node(RubyXL::Relationship, :collection => true, :accessor => :relationships)
19
18
  define_element_name 'Relationships'
20
19
  set_namespaces('xmlns' => 'http://schemas.openxmlformats.org/package/2006/relationships')
21
20
 
22
- attr_accessor :workbook
23
-
24
- def create_relationship(target, type)
21
+ def document_relationship(target, type)
25
22
  RubyXL::Relationship.new(:id => "rId#{relationships.size + 1}",
26
23
  :type => "http://schemas.openxmlformats.org/officeDocument/2006/relationships/#{type}",
27
24
  :target => target)
28
25
  end
26
+ protected :document_relationship
27
+
28
+ def metadata_relationship(target, type)
29
+ RubyXL::Relationship.new(:id => "rId#{relationships.size + 1}",
30
+ :type => "http://schemas.openxmlformats.org/package/2006/relationships/metadata/#{type}",
31
+ :target => target)
32
+ end
33
+ protected :metadata_relationship
34
+
35
+ def find_by_rid(r_id)
36
+ relationships.find { |r| r.id == r_id }
37
+ end
38
+ end
39
+
40
+
41
+ class WorkbookRelationships < OOXMLRelationshipsFile
42
+
43
+ attr_accessor :workbook
29
44
 
30
45
  def before_write_xml
31
46
  self.relationships = []
32
47
 
33
48
  @workbook.worksheets.each_with_index { |sheet, i|
34
- relationships << create_relationship(sheet.filepath.gsub(/^xl\//, ''), sheet.rel_type)
49
+ relationships << document_relationship(sheet.filepath.gsub(/^xl\//, ''), sheet.rel_type)
35
50
  }
36
51
 
37
52
  @workbook.external_links.each_key { |k|
38
- relationships << create_relationship("externalLinks/#{k}", 'externalLink')
53
+ relationships << document_relationship("externalLinks/#{k}", 'externalLink')
39
54
  }
40
55
 
41
- relationships << create_relationship('theme/theme1.xml', 'theme')
42
- relationships << create_relationship('styles.xml', 'styles')
56
+ relationships << document_relationship('theme/theme1.xml', 'theme')
57
+ relationships << document_relationship('styles.xml', 'styles')
43
58
 
44
59
  if @workbook.shared_strings_container && !@workbook.shared_strings_container.strings.empty? then
45
- relationships << create_relationship('sharedStrings.xml', 'sharedStrings')
60
+ relationships << document_relationship('sharedStrings.xml', 'sharedStrings')
46
61
  end
47
62
 
48
63
  if @workbook.calculation_chain && !@workbook.calculation_chain.cells.empty? then
49
- relationships << create_relationship('calcChain.xml', 'calcChain')
64
+ relationships << document_relationship('calcChain.xml', 'calcChain')
50
65
  end
51
66
 
52
67
  true
53
68
  end
54
69
 
55
- def find_by_rid(r_id)
56
- relationships.find { |r| r.id == r_id }
70
+ def self.filepath
71
+ File.join('xl', '_rels', 'workbook.xml.rels')
72
+ end
73
+
74
+ end
75
+
76
+ class RootRelationships < OOXMLRelationshipsFile
77
+
78
+ attr_accessor :workbook
79
+
80
+ def before_write_xml
81
+ self.relationships = []
82
+
83
+ relationships << document_relationship('xl/workbook.xml', 'officeDocument')
84
+ relationships << metadata_relationship('docProps/core.xml', 'core-properties')
85
+ relationships << document_relationship('docProps/app.xml', 'extended-properties')
86
+
87
+ true
57
88
  end
58
89
 
59
90
  def self.filepath
60
- File.join('xl', '_rels', 'workbook.xml.rels')
91
+ File.join('_rels', '.rels')
61
92
  end
62
93
  end
94
+
63
95
  end
@@ -53,13 +53,25 @@ module RubyXL
53
53
  value_container.value = v
54
54
  end
55
55
 
56
+ def number_format
57
+ workbook.stylesheet.get_number_format_by_id(get_cell_xf.num_fmt_id)
58
+ end
59
+
60
+ def is_date?
61
+ return false unless raw_value =~ /^\d+(?:\.\d+)$/ # Only fully numeric values can be dates
62
+ num_fmt = self.number_format
63
+ num_fmt && num_fmt.is_date_format?
64
+ end
65
+
66
+ # Gets massaged value of the cell, converting datatypes to those known to Ruby (that includes
67
+ # stripping any special formatting from RichText).
56
68
  def value(args = {})
57
69
  return raw_value if args[:raw]
58
70
  case datatype
59
71
  when RubyXL::Cell::SHARED_STRING then
60
- workbook.shared_strings_container[raw_value.to_i]
72
+ workbook.shared_strings_container[raw_value.to_i].to_s
61
73
  else
62
- if is_date? then workbook.num_to_date(raw_value.to_i)
74
+ if is_date? then workbook.num_to_date(raw_value.to_f)
63
75
  elsif raw_value.is_a?(String) && (raw_value =~ /^-?\d+(\.\d+(?:e[+-]\d+)?)?$/i) # Numeric
64
76
  if $1 then raw_value.to_f
65
77
  else raw_value.to_i
data/lib/rubyXL/parser.rb CHANGED
@@ -42,6 +42,7 @@ module RubyXL
42
42
  wb.filepath = xl_file_path
43
43
 
44
44
  wb.relationship_container = RubyXL::WorkbookRelationships.parse_file(dir_path)
45
+ wb.root_relationship_container = RubyXL::RootRelationships.parse_file(dir_path)
45
46
 
46
47
  unless @data_only
47
48
  wb.media.load_dir(dir_path)
@@ -1,6 +1,5 @@
1
1
  require 'rubyXL/writer/generic_writer'
2
2
  require 'rubyXL/writer/content_types_writer'
3
- require 'rubyXL/writer/root_rels_writer'
4
3
  require 'rubyXL/writer/core_writer'
5
4
  require 'rubyXL/writer/theme_writer'
6
5
  require 'rubyXL/writer/workbook_writer'
@@ -16,7 +15,7 @@ module RubyXL
16
15
  :worksheet_rels, :chartsheet_rels, :printer_settings, :macros
17
16
 
18
17
  attr_accessor :stylesheet, :shared_strings_container, :document_properties, :calculation_chain,
19
- :relationship_container
18
+ :relationship_container, :root_relationship_container
20
19
 
21
20
  SHEET_NAME_TEMPLATE = 'Sheet%d'
22
21
  APPLICATION = 'Microsoft Macintosh Excel'
@@ -53,6 +52,7 @@ module RubyXL
53
52
  @stylesheet = RubyXL::Stylesheet.default
54
53
  @document_properties = RubyXL::DocumentProperties.new
55
54
  @relationship_container = RubyXL::WorkbookRelationships.new
55
+ @root_relationship_container = RubyXL::RootRelationships.new
56
56
  @calculation_chain = nil
57
57
 
58
58
  self.company = company
@@ -109,7 +109,7 @@ module RubyXL
109
109
  zippath = File.join(temppath, 'file.zip')
110
110
 
111
111
  ::Zip::File.open(zippath, ::Zip::File::CREATE) { |zipfile|
112
- [ Writer::ContentTypesWriter, Writer::RootRelsWriter, Writer::CoreWriter,
112
+ [ Writer::ContentTypesWriter, Writer::CoreWriter,
113
113
  Writer::ThemeWriter, Writer::WorkbookWriter, Writer::StylesWriter
114
114
  ].each { |writer_class| writer_class.new(self).add_to_zip(zipfile) }
115
115
 
@@ -118,6 +118,7 @@ module RubyXL
118
118
  document_properties.add_to_zip(zipfile)
119
119
  relationship_container.workbook = self
120
120
  relationship_container.add_to_zip(zipfile)
121
+ root_relationship_container.add_to_zip(zipfile)
121
122
 
122
123
  [ @media, @external_links, @external_links_rels,
123
124
  @drawings, @drawings_rels, @charts, @chart_rels,
@@ -134,16 +135,16 @@ module RubyXL
134
135
 
135
136
  def base_date
136
137
  if date1904 then
137
- Date.new(1904, 1, 1)
138
+ DateTime.new(1904, 1, 1)
138
139
  else
139
140
  # Subtracting one day to accomodate for erroneous 1900 leap year compatibility only for 1900 based dates
140
- Date.new(1899, 12, 31) - 1
141
+ DateTime.new(1899, 12, 31) - 1
141
142
  end
142
143
  end
143
144
  private :base_date
144
145
 
145
146
  def date_to_num(date)
146
- date && (date.ajd - base_date().ajd).to_i
147
+ date && (date.ajd - base_date().ajd).to_f
147
148
  end
148
149
 
149
150
  def num_to_date(num)
@@ -4,7 +4,7 @@
4
4
  <head>
5
5
  <meta charset="UTF-8">
6
6
 
7
- <title>README - rubyXL 2.3.0</title>
7
+ <title>README - rubyXL 2.3.3</title>
8
8
 
9
9
  <link href="./fonts.css" rel="stylesheet">
10
10
  <link href="./rdoc.css" rel="stylesheet">
@@ -124,7 +124,7 @@
124
124
 
125
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
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>
127
+ <pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">&#39;rubyXL&#39;</span> <span class="ruby-comment"># Assuming rubygems is already required</span>
128
128
  </pre>
129
129
 
130
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>
@@ -141,7 +141,7 @@
141
141
 
142
142
  <pre>workbook.worksheets[0] # Returns first worksheet
143
143
  workbook[0] # Returns first worksheet
144
- workbook['Sheet1'] # Finds and returns worksheet titled &quot;Sheet1&quot;</pre>
144
+ workbook[&#39;Sheet1&#39;] # Finds and returns worksheet titled &quot;Sheet1&quot;</pre>
145
145
 
146
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
147
 
@@ -225,12 +225,12 @@ worksheet.get_column_border_right(0)</pre>
225
225
 
226
226
  <h4 id="label-Adding+Worksheets">Adding Worksheets<span><a href="#label-Adding+Worksheets">&para;</a> <a href="#documentation">&uarr;</a></span></h4>
227
227
 
228
- <pre>worlsheet = workbook.add_worksheet('Sheet2')</pre>
228
+ <pre>worlsheet = workbook.add_worksheet(&#39;Sheet2&#39;)</pre>
229
229
 
230
230
  <h4 id="label-Adding+Cells">Adding Cells<span><a href="#label-Adding+Cells">&para;</a> <a href="#documentation">&uarr;</a></span></h4>
231
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>
232
+ <pre>worksheet.add_cell(0, 0, &#39;A1&#39;) # Sets cell A1 to string &quot;A1&quot;
233
+ worksheet.add_cell(0, 1, &#39;&#39;, &#39;A1&#39;) # Sets formula in the cell B1 to &#39;=A1&#39;</pre>
234
234
 
235
235
  <h4 id="label-Changing+Cells">Changing Cells<span><a href="#label-Changing+Cells">&para;</a> <a href="#documentation">&uarr;</a></span></h4>
236
236
 
@@ -240,21 +240,21 @@ worksheet.add_cell(0, 1, '', 'A1') # Sets formula in the cell B1 to '=A1'</pre>
240
240
 
241
241
  <pre>worksheet.sheet_data[0][0].change_font_bold(true) # Makes A1 bold
242
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>
243
+ worksheet.change_column_font_name(0, &#39;Courier&#39;) # Makes first column have font Courier</pre>
244
244
 
245
245
  <h4 id="label-Changing+Fills+++++">Changing Fills <span><a href="#label-Changing+Fills+++++">&para;</a> <a href="#documentation">&uarr;</a></span></h4>
246
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>
247
+ <pre>worksheet.sheet_data[0][0].change_fill(&#39;0ba53d&#39;) # Sets A1 to have fill #0ba53d
248
+ worksheet.change_row_fill(0, &#39;0ba53d&#39;) # Sets first row to have fill #0ba53d
249
+ worksheet.change_column_fill(0, &#39;0ba53d&#39;) # Sets first column to have fill #0ba53d</pre>
250
250
 
251
251
  <h4 id="label-Changing+Borders">Changing Borders<span><a href="#label-Changing+Borders">&para;</a> <a href="#documentation">&uarr;</a></span></h4>
252
252
 
253
253
  <pre># Possible weights: hairline, thin, medium, thick
254
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>
255
+ worksheet.sheet_data[0][0].change_border_top(&#39;thin&#39;) # Sets A1 to have a top, thin border
256
+ worksheet.change_row_border_left(0, &#39;hairline&#39;) # Sets first row to have a left, hairline border
257
+ worksheet.change_column_border_diagonal(0, &#39;medium&#39;) # Sets first column to have diagonal, medium border</pre>
258
258
 
259
259
  <h4 id="label-Changing+Alignment">Changing Alignment<span><a href="#label-Changing+Alignment">&para;</a> <a href="#documentation">&uarr;</a></span></h4>
260
260
 
@@ -262,17 +262,17 @@ worksheet.change_column_border_diagonal(0, 'medium') # Sets first column to have
262
262
 
263
263
  <p>center, distributed, justify, left, right</p>
264
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>
265
+ <pre>worksheet.sheet_data[0][0].change_horizontal_alignment(&#39;center&#39;) # Sets A1 to be centered
266
+ worksheet.change_row_horizontal_alignment(0, &#39;justify&#39;) # Sets first row to be justified
267
+ worksheet.change_column_horizontal_alignment(0, &#39;right&#39;) # Sets first column to be right-aligned</pre>
268
268
 
269
269
  <h5 id="label-Vertical">Vertical<span><a href="#label-Vertical">&para;</a> <a href="#documentation">&uarr;</a></span></h5>
270
270
 
271
271
  <p>bottom, center, distributed, top</p>
272
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>
273
+ <pre>worksheet.sheet_data[0][0].change_vertical_alignment(&#39;bottom&#39;) # Sets A1 to be bottom aligned
274
+ worksheet.change_row_vertical_alignment(0, &#39;distributed&#39;) # Sets first row to be distributed vertically
275
+ worksheet.change_column_vertical_alignment(0, &#39;top&#39;) # Sets first column to be top aligned</pre>
276
276
 
277
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
278
 
@@ -359,8 +359,8 @@ worksheet.delete_cell(0, 0) # Deletes A1, does not shift cells</pre>
359
359
 
360
360
  <h3 id="label-Miscellaneous">Miscellaneous<span><a href="#label-Miscellaneous">&para;</a> <a href="#documentation">&uarr;</a></span></h3>
361
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>
362
+ <pre>Reference.ind2ref(0,0) == &#39;A1&#39; # Converts row and column index to Excel-style cell reference
363
+ Reference.ref2ind(&#39;A1&#39;) == [0, 0] # Converts Excel-style cell reference to row and column index</pre>
364
364
 
365
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
366
 
@@ -368,11 +368,11 @@ Reference.ref2ind('A1') == [0, 0] # Converts Excel-style cell reference to row a
368
368
 
369
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
370
  <ul><li>
371
- <p>Check out the latest master to make sure the feature hasnt been
372
- implemented or the bug hasnt been fixed yet</p>
371
+ <p>Check out the latest master to make sure the feature hasn&#39;t been
372
+ implemented or the bug hasn&#39;t been fixed yet</p>
373
373
  </li><li>
374
- <p>Check out the issue tracker to make sure someone already hasnt requested
375
- it and/or contributed it</p>
374
+ <p>Check out the issue tracker to make sure someone already hasn&#39;t
375
+ requested it and/or contributed it</p>
376
376
  </li><li>
377
377
  <p>Fork the project</p>
378
378
  </li><li>
@@ -380,8 +380,8 @@ it and/or contributed it</p>
380
380
  </li><li>
381
381
  <p>Commit and push until you are happy with your contribution</p>
382
382
  </li><li>
383
- <p>Make sure to add tests for it. This is important so I dont break it in a
384
- future version unintentionally.</p>
383
+ <p>Make sure to add tests for it. This is important so I don&#39;t break it in
384
+ a future version unintentionally.</p>
385
385
  </li><li>
386
386
  <p>Please try not to mess with the Rakefile, version, or history. If you want
387
387
  to have your own version, or is otherwise necessary, that is fine, but
@@ -4,7 +4,7 @@
4
4
  <head>
5
5
  <meta charset="UTF-8">
6
6
 
7
- <title>class RubyXL::AExtensionStorageArea - rubyXL 2.3.0</title>
7
+ <title>class RubyXL::AExtensionStorageArea - rubyXL 2.3.3</title>
8
8
 
9
9
  <link href="../fonts.css" rel="stylesheet">
10
10
  <link href="../rdoc.css" rel="stylesheet">
@@ -4,7 +4,7 @@
4
4
  <head>
5
5
  <meta charset="UTF-8">
6
6
 
7
- <title>class RubyXL::Alignment - rubyXL 2.3.0</title>
7
+ <title>class RubyXL::Alignment - rubyXL 2.3.3</title>
8
8
 
9
9
  <link href="../fonts.css" rel="stylesheet">
10
10
  <link href="../rdoc.css" rel="stylesheet">
@@ -4,7 +4,7 @@
4
4
  <head>
5
5
  <meta charset="UTF-8">
6
6
 
7
- <title>class RubyXL::AlternateContent - rubyXL 2.3.0</title>
7
+ <title>class RubyXL::AlternateContent - rubyXL 2.3.3</title>
8
8
 
9
9
  <link href="../fonts.css" rel="stylesheet">
10
10
  <link href="../rdoc.css" rel="stylesheet">
@@ -4,7 +4,7 @@
4
4
  <head>
5
5
  <meta charset="UTF-8">
6
6
 
7
- <title>class RubyXL::AutoFilter - rubyXL 2.3.0</title>
7
+ <title>class RubyXL::AutoFilter - rubyXL 2.3.3</title>
8
8
 
9
9
  <link href="../fonts.css" rel="stylesheet">
10
10
  <link href="../rdoc.css" rel="stylesheet">
@@ -4,7 +4,7 @@
4
4
  <head>
5
5
  <meta charset="UTF-8">
6
6
 
7
- <title>class RubyXL::AutoFilterColumn - rubyXL 2.3.0</title>
7
+ <title>class RubyXL::AutoFilterColumn - rubyXL 2.3.3</title>
8
8
 
9
9
  <link href="../fonts.css" rel="stylesheet">
10
10
  <link href="../rdoc.css" rel="stylesheet">
@@ -4,7 +4,7 @@
4
4
  <head>
5
5
  <meta charset="UTF-8">
6
6
 
7
- <title>class RubyXL::BooleanNode - rubyXL 2.3.0</title>
7
+ <title>class RubyXL::BooleanNode - rubyXL 2.3.3</title>
8
8
 
9
9
  <link href="../fonts.css" rel="stylesheet">
10
10
  <link href="../rdoc.css" rel="stylesheet">
@@ -4,7 +4,7 @@
4
4
  <head>
5
5
  <meta charset="UTF-8">
6
6
 
7
- <title>class RubyXL::BooleanValue - rubyXL 2.3.0</title>
7
+ <title>class RubyXL::BooleanValue - rubyXL 2.3.3</title>
8
8
 
9
9
  <link href="../fonts.css" rel="stylesheet">
10
10
  <link href="../rdoc.css" rel="stylesheet">
@@ -4,7 +4,7 @@
4
4
  <head>
5
5
  <meta charset="UTF-8">
6
6
 
7
- <title>class RubyXL::Border - rubyXL 2.3.0</title>
7
+ <title>class RubyXL::Border - rubyXL 2.3.3</title>
8
8
 
9
9
  <link href="../fonts.css" rel="stylesheet">
10
10
  <link href="../rdoc.css" rel="stylesheet">
@@ -4,7 +4,7 @@
4
4
  <head>
5
5
  <meta charset="UTF-8">
6
6
 
7
- <title>class RubyXL::BorderEdge - rubyXL 2.3.0</title>
7
+ <title>class RubyXL::BorderEdge - rubyXL 2.3.3</title>
8
8
 
9
9
  <link href="../fonts.css" rel="stylesheet">
10
10
  <link href="../rdoc.css" rel="stylesheet">
@@ -4,7 +4,7 @@
4
4
  <head>
5
5
  <meta charset="UTF-8">
6
6
 
7
- <title>class RubyXL::Borders - rubyXL 2.3.0</title>
7
+ <title>class RubyXL::Borders - rubyXL 2.3.3</title>
8
8
 
9
9
  <link href="../fonts.css" rel="stylesheet">
10
10
  <link href="../rdoc.css" rel="stylesheet">
@@ -4,7 +4,7 @@
4
4
  <head>
5
5
  <meta charset="UTF-8">
6
6
 
7
- <title>class RubyXL::Break - rubyXL 2.3.0</title>
7
+ <title>class RubyXL::Break - rubyXL 2.3.3</title>
8
8
 
9
9
  <link href="../fonts.css" rel="stylesheet">
10
10
  <link href="../rdoc.css" rel="stylesheet">
@@ -4,7 +4,7 @@
4
4
  <head>
5
5
  <meta charset="UTF-8">
6
6
 
7
- <title>class RubyXL::BreakList - rubyXL 2.3.0</title>
7
+ <title>class RubyXL::BreakList - rubyXL 2.3.3</title>
8
8
 
9
9
  <link href="../fonts.css" rel="stylesheet">
10
10
  <link href="../rdoc.css" rel="stylesheet">
@@ -4,7 +4,7 @@
4
4
  <head>
5
5
  <meta charset="UTF-8">
6
6
 
7
- <title>class RubyXL::CalculationChain - rubyXL 2.3.0</title>
7
+ <title>class RubyXL::CalculationChain - rubyXL 2.3.3</title>
8
8
 
9
9
  <link href="../fonts.css" rel="stylesheet">
10
10
  <link href="../rdoc.css" rel="stylesheet">
@@ -133,7 +133,7 @@ href="http://www.schemacentral.com/sc/ooxml/e-ssml_calcChain.html">www.schemacen
133
133
  <div class="method-source-code" id="filepath-source">
134
134
  <pre><span class="ruby-comment"># File lib/rubyXL/objects/calculation_chain.rb, line 24</span>
135
135
  <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">filepath</span>
136
- <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">'xl'</span>, <span class="ruby-string">'calcChain.xml'</span>)
136
+ <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">&#39;xl&#39;</span>, <span class="ruby-string">&#39;calcChain.xml&#39;</span>)
137
137
  <span class="ruby-keyword">end</span></pre>
138
138
  </div>
139
139
 
@@ -4,7 +4,7 @@
4
4
  <head>
5
5
  <meta charset="UTF-8">
6
6
 
7
- <title>class RubyXL::CalculationChainCell - rubyXL 2.3.0</title>
7
+ <title>class RubyXL::CalculationChainCell - rubyXL 2.3.3</title>
8
8
 
9
9
  <link href="../fonts.css" rel="stylesheet">
10
10
  <link href="../rdoc.css" rel="stylesheet">
@@ -4,7 +4,7 @@
4
4
  <head>
5
5
  <meta charset="UTF-8">
6
6
 
7
- <title>class RubyXL::CalculationProperties - rubyXL 2.3.0</title>
7
+ <title>class RubyXL::CalculationProperties - rubyXL 2.3.3</title>
8
8
 
9
9
  <link href="../fonts.css" rel="stylesheet">
10
10
  <link href="../rdoc.css" rel="stylesheet">