rubyXL 3.1.2 → 3.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 (376) hide show
  1. checksums.yaml +7 -0
  2. data/VERSION +1 -1
  3. data/lib/rubyXL/cell.rb +1 -1
  4. data/lib/rubyXL/objects/calculation_chain.rb +1 -1
  5. data/lib/rubyXL/objects/chartsheet.rb +1 -2
  6. data/lib/rubyXL/objects/column_range.rb +1 -1
  7. data/lib/rubyXL/objects/comments.rb +1 -1
  8. data/lib/rubyXL/objects/content_types.rb +41 -26
  9. data/lib/rubyXL/objects/document_properties.rb +21 -11
  10. data/lib/rubyXL/objects/filters.rb +2 -2
  11. data/lib/rubyXL/objects/font.rb +1 -1
  12. data/lib/rubyXL/objects/ooxml_object.rb +22 -18
  13. data/lib/rubyXL/objects/reference.rb +3 -3
  14. data/lib/rubyXL/objects/relationships.rb +34 -70
  15. data/lib/rubyXL/objects/root.rb +7 -8
  16. data/lib/rubyXL/objects/shared_strings.rb +4 -4
  17. data/lib/rubyXL/objects/sheet_data.rb +2 -2
  18. data/lib/rubyXL/objects/simple_types.rb +2 -2
  19. data/lib/rubyXL/objects/storage.rb +9 -10
  20. data/lib/rubyXL/objects/stylesheet.rb +3 -3
  21. data/lib/rubyXL/objects/theme.rb +2 -2
  22. data/lib/rubyXL/objects/workbook.rb +2 -4
  23. data/lib/rubyXL/objects/worksheet.rb +6 -6
  24. data/lib/rubyXL/workbook.rb +4 -4
  25. data/lib/rubyXL/worksheet.rb +8 -8
  26. data/rdoc/README_rdoc.html +28 -28
  27. data/rdoc/RubyXL.html +1 -1
  28. data/rdoc/RubyXL/AExtension.html +1 -1
  29. data/rdoc/RubyXL/AExtensionStorageArea.html +1 -1
  30. data/rdoc/RubyXL/AdjustHandleList.html +1 -1
  31. data/rdoc/RubyXL/Alignment.html +1 -1
  32. data/rdoc/RubyXL/AlternateContent.html +1 -1
  33. data/rdoc/RubyXL/Authors.html +1 -1
  34. data/rdoc/RubyXL/AutoFilter.html +1 -1
  35. data/rdoc/RubyXL/AutoFilterColumn.html +1 -1
  36. data/rdoc/RubyXL/BinaryImageFile.html +1 -1
  37. data/rdoc/RubyXL/BodyProperties.html +1 -1
  38. data/rdoc/RubyXL/BooleanNode.html +1 -1
  39. data/rdoc/RubyXL/BooleanValue.html +1 -1
  40. data/rdoc/RubyXL/Border.html +1 -1
  41. data/rdoc/RubyXL/BorderEdge.html +1 -1
  42. data/rdoc/RubyXL/Borders.html +1 -1
  43. data/rdoc/RubyXL/Break.html +1 -1
  44. data/rdoc/RubyXL/BreakList.html +1 -1
  45. data/rdoc/RubyXL/CT_AdjPoint2D.html +1 -1
  46. data/rdoc/RubyXL/CT_AlphaBiLevelEffect.html +1 -1
  47. data/rdoc/RubyXL/CT_AlphaModulateEffect.html +1 -1
  48. data/rdoc/RubyXL/CT_AlphaModulateFixedEffect.html +1 -1
  49. data/rdoc/RubyXL/CT_AlphaOutsetEffect.html +1 -1
  50. data/rdoc/RubyXL/CT_AlphaReplaceEffect.html +1 -1
  51. data/rdoc/RubyXL/CT_Backdrop.html +1 -1
  52. data/rdoc/RubyXL/CT_Bevel.html +1 -1
  53. data/rdoc/RubyXL/CT_BiLevelEffect.html +1 -1
  54. data/rdoc/RubyXL/CT_BlendEffect.html +1 -1
  55. data/rdoc/RubyXL/CT_Blip.html +1 -1
  56. data/rdoc/RubyXL/CT_BlipFillProperties.html +1 -1
  57. data/rdoc/RubyXL/CT_BlurEffect.html +1 -1
  58. data/rdoc/RubyXL/CT_Camera.html +1 -1
  59. data/rdoc/RubyXL/CT_Color.html +1 -1
  60. data/rdoc/RubyXL/CT_ColorChangeEffect.html +1 -1
  61. data/rdoc/RubyXL/CT_ColorMapping.html +1 -1
  62. data/rdoc/RubyXL/CT_ColorScheme.html +1 -1
  63. data/rdoc/RubyXL/CT_ColorSchemeAndMapping.html +1 -1
  64. data/rdoc/RubyXL/CT_ConnectionSite.html +1 -1
  65. data/rdoc/RubyXL/CT_ConnectionSiteList.html +1 -1
  66. data/rdoc/RubyXL/CT_DashStop.html +1 -1
  67. data/rdoc/RubyXL/CT_DashStopList.html +1 -1
  68. data/rdoc/RubyXL/CT_DefaultShapeDefinition.html +1 -1
  69. data/rdoc/RubyXL/CT_DuotoneEffect.html +1 -1
  70. data/rdoc/RubyXL/CT_EffectContainer.html +1 -1
  71. data/rdoc/RubyXL/CT_EffectList.html +1 -1
  72. data/rdoc/RubyXL/CT_EffectReference.html +1 -1
  73. data/rdoc/RubyXL/CT_EffectStyleItem.html +1 -1
  74. data/rdoc/RubyXL/CT_EffectStyleList.html +1 -1
  75. data/rdoc/RubyXL/CT_EmbeddedWAVAudioFile.html +1 -1
  76. data/rdoc/RubyXL/CT_FillEffect.html +1 -1
  77. data/rdoc/RubyXL/CT_FillOverlayEffect.html +1 -1
  78. data/rdoc/RubyXL/CT_FillStyleList.html +1 -1
  79. data/rdoc/RubyXL/CT_FlatText.html +1 -1
  80. data/rdoc/RubyXL/CT_FontCollection.html +1 -1
  81. data/rdoc/RubyXL/CT_FontReference.html +1 -1
  82. data/rdoc/RubyXL/CT_GeomGuideList.html +1 -1
  83. data/rdoc/RubyXL/CT_GlowEffect.html +1 -1
  84. data/rdoc/RubyXL/CT_GradientFillProperties.html +1 -1
  85. data/rdoc/RubyXL/CT_GradientStop.html +1 -1
  86. data/rdoc/RubyXL/CT_GradientStopList.html +1 -1
  87. data/rdoc/RubyXL/CT_HSLEffect.html +1 -1
  88. data/rdoc/RubyXL/CT_HslColor.html +1 -1
  89. data/rdoc/RubyXL/CT_Hyperlink.html +1 -1
  90. data/rdoc/RubyXL/CT_InnerShadowEffect.html +1 -1
  91. data/rdoc/RubyXL/CT_LightRig.html +1 -1
  92. data/rdoc/RubyXL/CT_LineEndProperties.html +1 -1
  93. data/rdoc/RubyXL/CT_LineJoinMiterProperties.html +1 -1
  94. data/rdoc/RubyXL/CT_LineProperties.html +1 -1
  95. data/rdoc/RubyXL/CT_LineStyleList.html +1 -1
  96. data/rdoc/RubyXL/CT_LinearShadeProperties.html +1 -1
  97. data/rdoc/RubyXL/CT_LuminanceEffect.html +1 -1
  98. data/rdoc/RubyXL/CT_ObjectStyleDefaults.html +1 -1
  99. data/rdoc/RubyXL/CT_OuterShadowEffect.html +1 -1
  100. data/rdoc/RubyXL/CT_Path2D.html +1 -1
  101. data/rdoc/RubyXL/CT_Path2DArcTo.html +1 -1
  102. data/rdoc/RubyXL/CT_Path2DCubicBezierTo.html +1 -1
  103. data/rdoc/RubyXL/CT_Path2DList.html +1 -1
  104. data/rdoc/RubyXL/CT_Path2DQuadBezierTo.html +1 -1
  105. data/rdoc/RubyXL/CT_Path2DTo.html +1 -1
  106. data/rdoc/RubyXL/CT_PathShadeProperties.html +1 -1
  107. data/rdoc/RubyXL/CT_PatternFillProperties.html +1 -1
  108. data/rdoc/RubyXL/CT_Point3D.html +1 -1
  109. data/rdoc/RubyXL/CT_PolarAdjustHandle.html +1 -1
  110. data/rdoc/RubyXL/CT_PresetColor.html +1 -1
  111. data/rdoc/RubyXL/CT_PresetLineDashProperties.html +1 -1
  112. data/rdoc/RubyXL/CT_PresetShadowEffect.html +1 -1
  113. data/rdoc/RubyXL/CT_PresetTextShape.html +1 -1
  114. data/rdoc/RubyXL/CT_ReflectionEffect.html +1 -1
  115. data/rdoc/RubyXL/CT_RelativeOffsetEffect.html +1 -1
  116. data/rdoc/RubyXL/CT_RelativeRect.html +1 -1
  117. data/rdoc/RubyXL/CT_SRgbColor.html +1 -1
  118. data/rdoc/RubyXL/CT_ScRgbColor.html +1 -1
  119. data/rdoc/RubyXL/CT_Scene3D.html +1 -1
  120. data/rdoc/RubyXL/CT_SchemeColor.html +1 -1
  121. data/rdoc/RubyXL/CT_Shape3D.html +1 -1
  122. data/rdoc/RubyXL/CT_ShapeStyle.html +1 -1
  123. data/rdoc/RubyXL/CT_SoftEdgesEffect.html +1 -1
  124. data/rdoc/RubyXL/CT_SphereCoords.html +1 -1
  125. data/rdoc/RubyXL/CT_StretchInfoProperties.html +1 -1
  126. data/rdoc/RubyXL/CT_StyleMatrix.html +1 -1
  127. data/rdoc/RubyXL/CT_StyleMatrixReference.html +1 -1
  128. data/rdoc/RubyXL/CT_SupplementalFont.html +1 -1
  129. data/rdoc/RubyXL/CT_SystemColor.html +1 -1
  130. data/rdoc/RubyXL/CT_TextAutonumberBullet.html +1 -1
  131. data/rdoc/RubyXL/CT_TextBlipBullet.html +1 -1
  132. data/rdoc/RubyXL/CT_TextCharBullet.html +1 -1
  133. data/rdoc/RubyXL/CT_TextCharacterProperties.html +1 -1
  134. data/rdoc/RubyXL/CT_TextFont.html +1 -1
  135. data/rdoc/RubyXL/CT_TextListStyle.html +1 -1
  136. data/rdoc/RubyXL/CT_TextNormalAutofit.html +1 -1
  137. data/rdoc/RubyXL/CT_TextParagraphProperties.html +1 -1
  138. data/rdoc/RubyXL/CT_TextSpacing.html +1 -1
  139. data/rdoc/RubyXL/CT_TextTabStop.html +1 -1
  140. data/rdoc/RubyXL/CT_TextTabStopList.html +1 -1
  141. data/rdoc/RubyXL/CT_TileInfoProperties.html +1 -1
  142. data/rdoc/RubyXL/CT_TintEffect.html +1 -1
  143. data/rdoc/RubyXL/CT_Transform2D.html +1 -1
  144. data/rdoc/RubyXL/CT_TransformEffect.html +1 -1
  145. data/rdoc/RubyXL/CT_Vector3D.html +1 -1
  146. data/rdoc/RubyXL/CT_XYAdjustHandle.html +1 -1
  147. data/rdoc/RubyXL/CalculationChain.html +2 -2
  148. data/rdoc/RubyXL/CalculationChainCell.html +1 -1
  149. data/rdoc/RubyXL/CalculationProperties.html +1 -1
  150. data/rdoc/RubyXL/Cell.html +2 -2
  151. data/rdoc/RubyXL/CellSmartTag.html +1 -1
  152. data/rdoc/RubyXL/CellSmartTagProperty.html +1 -1
  153. data/rdoc/RubyXL/CellSmartTags.html +1 -1
  154. data/rdoc/RubyXL/CellStyle.html +1 -1
  155. data/rdoc/RubyXL/CellStyleXFs.html +1 -1
  156. data/rdoc/RubyXL/CellStyles.html +1 -1
  157. data/rdoc/RubyXL/CellValue.html +2 -2
  158. data/rdoc/RubyXL/CellWatch.html +1 -1
  159. data/rdoc/RubyXL/CellWatches.html +1 -1
  160. data/rdoc/RubyXL/CellXFs.html +1 -1
  161. data/rdoc/RubyXL/ChartColorsFile.html +1 -1
  162. data/rdoc/RubyXL/ChartFile.html +1 -1
  163. data/rdoc/RubyXL/ChartStyleFile.html +1 -1
  164. data/rdoc/RubyXL/ChartUserShapesFile.html +1 -1
  165. data/rdoc/RubyXL/Chartsheet.html +1 -1
  166. data/rdoc/RubyXL/ChartsheetPageSetup.html +1 -1
  167. data/rdoc/RubyXL/ChartsheetProperties.html +1 -1
  168. data/rdoc/RubyXL/ChartsheetProtection.html +1 -1
  169. data/rdoc/RubyXL/ChartsheetView.html +1 -1
  170. data/rdoc/RubyXL/ChartsheetViews.html +1 -1
  171. data/rdoc/RubyXL/Color.html +3 -3
  172. data/rdoc/RubyXL/ColorFilter.html +1 -1
  173. data/rdoc/RubyXL/ColorScale.html +1 -1
  174. data/rdoc/RubyXL/ColorSet.html +1 -1
  175. data/rdoc/RubyXL/Colors.html +1 -1
  176. data/rdoc/RubyXL/ColumnRange.html +1 -1
  177. data/rdoc/RubyXL/ColumnRanges.html +2 -2
  178. data/rdoc/RubyXL/Comment.html +1 -1
  179. data/rdoc/RubyXL/CommentList.html +1 -1
  180. data/rdoc/RubyXL/CommentsFile.html +1 -1
  181. data/rdoc/RubyXL/ConditionalFormatValue.html +1 -1
  182. data/rdoc/RubyXL/ConditionalFormatting.html +1 -1
  183. data/rdoc/RubyXL/ConditionalFormattingRule.html +1 -1
  184. data/rdoc/RubyXL/ContentTypeDefault.html +1 -1
  185. data/rdoc/RubyXL/ContentTypeOverride.html +1 -1
  186. data/rdoc/RubyXL/ContentTypes.html +42 -76
  187. data/rdoc/RubyXL/ControlPropertiesFile.html +1 -1
  188. data/rdoc/RubyXL/CorePropertiesFile.html +1 -1
  189. data/rdoc/RubyXL/CustomColor.html +1 -1
  190. data/rdoc/RubyXL/CustomColorList.html +1 -1
  191. data/rdoc/RubyXL/CustomFilter.html +1 -1
  192. data/rdoc/RubyXL/CustomFilters.html +1 -1
  193. data/rdoc/RubyXL/CustomGeometry.html +1 -1
  194. data/rdoc/RubyXL/CustomProperties.html +1 -1
  195. data/rdoc/RubyXL/CustomPropertiesFile.html +1 -1
  196. data/rdoc/RubyXL/CustomProperty.html +1 -1
  197. data/rdoc/RubyXL/CustomSheetView.html +1 -1
  198. data/rdoc/RubyXL/CustomSheetViews.html +1 -1
  199. data/rdoc/RubyXL/CustomWorkbookView.html +1 -1
  200. data/rdoc/RubyXL/CustomWorkbookViews.html +1 -1
  201. data/rdoc/RubyXL/CustomXMLFile.html +1 -1
  202. data/rdoc/RubyXL/DXF.html +1 -1
  203. data/rdoc/RubyXL/DXFs.html +1 -1
  204. data/rdoc/RubyXL/DataBar.html +1 -1
  205. data/rdoc/RubyXL/DataConsolidate.html +1 -1
  206. data/rdoc/RubyXL/DataConsolidationReference.html +1 -1
  207. data/rdoc/RubyXL/DataConsolidationReferences.html +1 -1
  208. data/rdoc/RubyXL/DataType.html +1 -1
  209. data/rdoc/RubyXL/DataValidation.html +1 -1
  210. data/rdoc/RubyXL/DataValidations.html +1 -1
  211. data/rdoc/RubyXL/DateGroupItem.html +1 -1
  212. data/rdoc/RubyXL/DefinedName.html +1 -1
  213. data/rdoc/RubyXL/DefinedNames.html +1 -1
  214. data/rdoc/RubyXL/DocumentPropertiesFile.html +21 -46
  215. data/rdoc/RubyXL/DrawingFile.html +2 -7
  216. data/rdoc/RubyXL/DynamicFilter.html +1 -1
  217. data/rdoc/RubyXL/EmbeddedControl.html +1 -1
  218. data/rdoc/RubyXL/EmbeddedControls.html +1 -1
  219. data/rdoc/RubyXL/Extension.html +1 -1
  220. data/rdoc/RubyXL/ExtensionStorageArea.html +1 -1
  221. data/rdoc/RubyXL/Extents.html +1 -1
  222. data/rdoc/RubyXL/ExternalLinksFile.html +1 -1
  223. data/rdoc/RubyXL/ExternalReference.html +1 -1
  224. data/rdoc/RubyXL/ExternalReferences.html +1 -1
  225. data/rdoc/RubyXL/ExtraColorSchemeList.html +1 -1
  226. data/rdoc/RubyXL/FieldItem.html +1 -1
  227. data/rdoc/RubyXL/FileRecoveryProperties.html +1 -1
  228. data/rdoc/RubyXL/FileSharing.html +1 -1
  229. data/rdoc/RubyXL/FileVersion.html +1 -1
  230. data/rdoc/RubyXL/Fill.html +1 -1
  231. data/rdoc/RubyXL/Fills.html +1 -1
  232. data/rdoc/RubyXL/FilterContainer.html +1 -1
  233. data/rdoc/RubyXL/FloatNode.html +1 -1
  234. data/rdoc/RubyXL/FloatValue.html +1 -1
  235. data/rdoc/RubyXL/Font.html +3 -3
  236. data/rdoc/RubyXL/FontScheme.html +1 -1
  237. data/rdoc/RubyXL/Fonts.html +1 -1
  238. data/rdoc/RubyXL/Formula.html +1 -1
  239. data/rdoc/RubyXL/FunctionGroup.html +1 -1
  240. data/rdoc/RubyXL/FunctionGroups.html +1 -1
  241. data/rdoc/RubyXL/GenericStorageObject.html +10 -24
  242. data/rdoc/RubyXL/GradientFill.html +1 -1
  243. data/rdoc/RubyXL/HeaderFooterSettings.html +1 -1
  244. data/rdoc/RubyXL/Hyperlink.html +1 -1
  245. data/rdoc/RubyXL/HyperlinkRelFile.html +1 -1
  246. data/rdoc/RubyXL/Hyperlinks.html +1 -1
  247. data/rdoc/RubyXL/IconFilter.html +1 -1
  248. data/rdoc/RubyXL/IconSet.html +1 -1
  249. data/rdoc/RubyXL/IgnoredError.html +1 -1
  250. data/rdoc/RubyXL/IgnoredErrors.html +1 -1
  251. data/rdoc/RubyXL/IndexedColors.html +1 -1
  252. data/rdoc/RubyXL/InputCells.html +1 -1
  253. data/rdoc/RubyXL/IntegerNode.html +1 -1
  254. data/rdoc/RubyXL/IntegerValue.html +1 -1
  255. data/rdoc/RubyXL/LegacyCell.html +24 -24
  256. data/rdoc/RubyXL/LegacyWorkbook.html +10 -10
  257. data/rdoc/RubyXL/LegacyWorksheet.html +32 -32
  258. data/rdoc/RubyXL/MRUColors.html +1 -1
  259. data/rdoc/RubyXL/MacrosFile.html +1 -1
  260. data/rdoc/RubyXL/MergedCell.html +1 -1
  261. data/rdoc/RubyXL/MergedCells.html +1 -1
  262. data/rdoc/RubyXL/NumFmt.html +1 -1
  263. data/rdoc/RubyXL/NumberFormat.html +2 -2
  264. data/rdoc/RubyXL/NumberFormats.html +1 -1
  265. data/rdoc/RubyXL/OLEObject.html +1 -1
  266. data/rdoc/RubyXL/OLEObjects.html +1 -1
  267. data/rdoc/RubyXL/OLESize.html +1 -1
  268. data/rdoc/RubyXL/OOXMLContainerObject.html +1 -1
  269. data/rdoc/RubyXL/OOXMLObject.html +1 -1
  270. data/rdoc/RubyXL/OOXMLObjectClassMethods.html +18 -18
  271. data/rdoc/RubyXL/OOXMLObjectInstanceMethods.html +1 -1
  272. data/rdoc/RubyXL/OOXMLRelationshipsFile.html +119 -23
  273. data/rdoc/RubyXL/OOXMLTopLevelObject.html +1 -1
  274. data/rdoc/RubyXL/Offset.html +1 -1
  275. data/rdoc/RubyXL/OutlineProperties.html +1 -1
  276. data/rdoc/RubyXL/PageMargins.html +1 -1
  277. data/rdoc/RubyXL/PageSetup.html +1 -1
  278. data/rdoc/RubyXL/PageSetupProperties.html +1 -1
  279. data/rdoc/RubyXL/Pane.html +1 -1
  280. data/rdoc/RubyXL/Parser.html +1 -1
  281. data/rdoc/RubyXL/PatternFill.html +1 -1
  282. data/rdoc/RubyXL/PhoneticProperties.html +1 -1
  283. data/rdoc/RubyXL/PhoneticRun.html +1 -1
  284. data/rdoc/RubyXL/PivotArea.html +1 -1
  285. data/rdoc/RubyXL/PivotCache.html +1 -1
  286. data/rdoc/RubyXL/PivotCacheDefinitionFile.html +1 -1
  287. data/rdoc/RubyXL/PivotCaches.html +1 -1
  288. data/rdoc/RubyXL/PivotReference.html +1 -1
  289. data/rdoc/RubyXL/PivotReferences.html +1 -1
  290. data/rdoc/RubyXL/PivotTableFile.html +1 -1
  291. data/rdoc/RubyXL/PivotTableSelection.html +1 -1
  292. data/rdoc/RubyXL/PresetGeometry.html +1 -1
  293. data/rdoc/RubyXL/PrintOptions.html +1 -1
  294. data/rdoc/RubyXL/PrinterSettingsFile.html +6 -1
  295. data/rdoc/RubyXL/ProtectedRange.html +1 -1
  296. data/rdoc/RubyXL/ProtectedRanges.html +1 -1
  297. data/rdoc/RubyXL/Protection.html +1 -1
  298. data/rdoc/RubyXL/RID.html +1 -1
  299. data/rdoc/RubyXL/RawOOXML.html +1 -1
  300. data/rdoc/RubyXL/Reference.html +7 -7
  301. data/rdoc/RubyXL/Relationship.html +1 -1
  302. data/rdoc/RubyXL/RelationshipSupport.html +1 -1
  303. data/rdoc/RubyXL/RelationshipSupport/ClassMehods.html +1 -1
  304. data/rdoc/RubyXL/RichText.html +1 -1
  305. data/rdoc/RubyXL/RichTextRun.html +1 -1
  306. data/rdoc/RubyXL/Row.html +1 -1
  307. data/rdoc/RubyXL/RunProperties.html +1 -1
  308. data/rdoc/RubyXL/Scenario.html +1 -1
  309. data/rdoc/RubyXL/Scenarios.html +1 -1
  310. data/rdoc/RubyXL/Selection.html +1 -1
  311. data/rdoc/RubyXL/ShapeGuide.html +1 -1
  312. data/rdoc/RubyXL/ShapeTextRectangle.html +1 -1
  313. data/rdoc/RubyXL/SharedStringsTable.html +5 -5
  314. data/rdoc/RubyXL/Sheet.html +1 -1
  315. data/rdoc/RubyXL/SheetCalculationProperties.html +1 -1
  316. data/rdoc/RubyXL/SheetData.html +1 -1
  317. data/rdoc/RubyXL/Sheets.html +1 -1
  318. data/rdoc/RubyXL/SlicerCacheFile.html +1 -1
  319. data/rdoc/RubyXL/SlicerFile.html +1 -1
  320. data/rdoc/RubyXL/SmartTagProperties.html +1 -1
  321. data/rdoc/RubyXL/SmartTagType.html +1 -1
  322. data/rdoc/RubyXL/SmartTagTypes.html +1 -1
  323. data/rdoc/RubyXL/SmartTags.html +1 -1
  324. data/rdoc/RubyXL/SortCondition.html +1 -1
  325. data/rdoc/RubyXL/SortState.html +1 -1
  326. data/rdoc/RubyXL/Sqref.html +2 -2
  327. data/rdoc/RubyXL/Stop.html +1 -1
  328. data/rdoc/RubyXL/StringNode.html +1 -1
  329. data/rdoc/RubyXL/StringNodeW3C.html +1 -1
  330. data/rdoc/RubyXL/StringValue.html +1 -1
  331. data/rdoc/RubyXL/Stylesheet.html +1 -1
  332. data/rdoc/RubyXL/TableFile.html +1 -1
  333. data/rdoc/RubyXL/TableParts.html +1 -1
  334. data/rdoc/RubyXL/TableStyle.html +1 -1
  335. data/rdoc/RubyXL/TableStyles.html +1 -1
  336. data/rdoc/RubyXL/Text.html +2 -2
  337. data/rdoc/RubyXL/Theme.html +1 -1
  338. data/rdoc/RubyXL/ThemeElements.html +1 -1
  339. data/rdoc/RubyXL/ThumbnailFile.html +1 -1
  340. data/rdoc/RubyXL/Top10.html +1 -1
  341. data/rdoc/RubyXL/VMLDrawingFile.html +1 -1
  342. data/rdoc/RubyXL/Variant.html +1 -1
  343. data/rdoc/RubyXL/Vector.html +1 -1
  344. data/rdoc/RubyXL/VectorValue.html +1 -1
  345. data/rdoc/RubyXL/VisualProperties.html +1 -1
  346. data/rdoc/RubyXL/WebPublishObject.html +1 -1
  347. data/rdoc/RubyXL/WebPublishObjects.html +1 -1
  348. data/rdoc/RubyXL/WebPublishingItem.html +1 -1
  349. data/rdoc/RubyXL/WebPublishingItems.html +1 -1
  350. data/rdoc/RubyXL/WebPublishingProperties.html +1 -1
  351. data/rdoc/RubyXL/Workbook.html +1 -1
  352. data/rdoc/RubyXL/WorkbookProperties.html +1 -1
  353. data/rdoc/RubyXL/WorkbookProtection.html +1 -1
  354. data/rdoc/RubyXL/WorkbookRoot.html +43 -25
  355. data/rdoc/RubyXL/WorkbookView.html +1 -1
  356. data/rdoc/RubyXL/WorkbookViews.html +1 -1
  357. data/rdoc/RubyXL/Worksheet.html +1 -1
  358. data/rdoc/RubyXL/WorksheetDimensions.html +1 -1
  359. data/rdoc/RubyXL/WorksheetFormatProperties.html +1 -1
  360. data/rdoc/RubyXL/WorksheetProperties.html +1 -1
  361. data/rdoc/RubyXL/WorksheetProtection.html +1 -1
  362. data/rdoc/RubyXL/WorksheetView.html +1 -1
  363. data/rdoc/RubyXL/WorksheetViews.html +1 -1
  364. data/rdoc/RubyXL/XF.html +1 -1
  365. data/rdoc/created.rid +37 -37
  366. data/rdoc/index.html +2 -2
  367. data/rdoc/js/search_index.js +1 -1
  368. data/rdoc/table_of_contents.html +68 -63
  369. data/rubyXL.gemspec +6 -11
  370. metadata +92 -86
  371. data/rdoc/RubyXL/ChartRelationshipsFile.html +0 -105
  372. data/rdoc/RubyXL/DrawingRelationshipsFile.html +0 -105
  373. data/rdoc/RubyXL/REL_CLASS.html +0 -105
  374. data/rdoc/RubyXL/RootRelationships.html +0 -105
  375. data/rdoc/RubyXL/SheetRelationshipsFile.html +0 -105
  376. data/rdoc/RubyXL/WorkbookRelationships.html +0 -105
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ffb91460026cf30dfbf10d1d1461f7e31ed08ab4
4
+ data.tar.gz: f2252518b4746190e8b9961de5c7e8cd7144ab06
5
+ SHA512:
6
+ metadata.gz: 1547a5b7923c072f332e2ac7dbb73b0cdbd7af5ce2b1bc15f8b19552ebbfd62fd6fe1bcabb54970b73409d8eecf4fca5a3b1921b83170d736fdd11dce1b8b33f
7
+ data.tar.gz: d8ecbc5d39b25f04f80358c5932f09e170957d7f5f4ccc88f257a9229c3e470325ff0bcdf6883e1db98f102f1c2a70c0143528a701fe4258d9f3df1451115d98
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.1.2
1
+ 3.2.0
data/lib/rubyXL/cell.rb CHANGED
@@ -255,7 +255,7 @@ module RubyXL
255
255
  end
256
256
 
257
257
  def inspect
258
- str = "#<#{self.class}(#{row},#{column}): #{raw_value.inspect}"
258
+ str = "#<#{self.class}(#{row},#{column}): #{raw_value.inspect}"
259
259
  str += " =#{self.formula.expression}" if self.formula
260
260
  str += ", datatype = #{self.datatype}, style_index = #{self.style_index}>"
261
261
  return str
@@ -25,7 +25,7 @@ module RubyXL
25
25
  set_namespaces('http://schemas.openxmlformats.org/spreadsheetml/2006/main' => '')
26
26
 
27
27
  def xlsx_path
28
- File.join('xl', 'calcChain.xml')
28
+ ROOT.join('xl', 'calcChain.xml')
29
29
  end
30
30
  end
31
31
  end
@@ -59,7 +59,6 @@ module RubyXL
59
59
  class Chartsheet < OOXMLTopLevelObject
60
60
  CONTENT_TYPE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml'
61
61
  REL_TYPE = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/chartsheet'
62
- REL_CLASS = RubyXL::SheetRelationshipsFile
63
62
 
64
63
  include RubyXL::RelationshipSupport
65
64
  define_relationship(RubyXL::DrawingFile)
@@ -85,7 +84,7 @@ module RubyXL
85
84
  'http://schemas.openxmlformats.org/officeDocument/2006/relationships' => 'r')
86
85
 
87
86
  def xlsx_path
88
- File.join('xl', 'chartsheets', "sheet#{file_index}.xml")
87
+ ROOT.join('xl', 'chartsheets', "sheet#{file_index}.xml")
89
88
  end
90
89
 
91
90
  end
@@ -50,7 +50,7 @@ module RubyXL
50
50
  new_range = RubyXL::ColumnRange.new(:min => col_num, :max => col_num)
51
51
  self.column_ranges << new_range
52
52
  return new_range
53
- elsif old_range.min == col_num &&
53
+ elsif old_range.min == col_num &&
54
54
  old_range.max == col_num then # Single column range, OK to change in place
55
55
  return old_range
56
56
  else
@@ -38,7 +38,7 @@ module RubyXL
38
38
  attr_accessor :workbook
39
39
 
40
40
  def xlsx_path
41
- File.join('xl', "comments#{file_index}.xml")
41
+ ROOT.join('xl', "comments#{file_index}.xml")
42
42
  end
43
43
 
44
44
  end
@@ -17,8 +17,6 @@ module RubyXL
17
17
  class ContentTypes < OOXMLTopLevelObject
18
18
  SAVE_ORDER = 999 # Must be saved last, so it has time to accumulate overrides from all others.
19
19
 
20
- attr_accessor :owner
21
-
22
20
  define_child_node(RubyXL::ContentTypeDefault, :collection => true, :accessor => :defaults)
23
21
  define_child_node(RubyXL::ContentTypeOverride, :collection => true, :accessor => :overrides)
24
22
 
@@ -26,37 +24,54 @@ module RubyXL
26
24
  define_element_name 'Types'
27
25
 
28
26
  def self.xlsx_path
29
- '[Content_Types].xml'
27
+ ROOT.join('[Content_Types].xml')
30
28
  end
31
29
 
32
30
  def xlsx_path
33
31
  self.class.xlsx_path
34
32
  end
35
33
 
36
-
37
- def add_override(obj)
38
- return unless obj.class.const_defined?(:CONTENT_TYPE)
39
- overrides << RubyXL::ContentTypeOverride.new(:part_name => "/#{obj.xlsx_path}", :content_type => obj.class::CONTENT_TYPE)
40
- end
41
-
42
34
  def before_write_xml
43
- self.defaults = []
44
- if owner.rels_hash[RubyXL::PrinterSettingsFile] then
45
- defaults << RubyXL::ContentTypeDefault.new(:extension => 'bin',
46
- :content_type => 'application/vnd.openxmlformats-officedocument.spreadsheetml.printerSettings')
47
- end
48
-
49
- defaults << RubyXL::ContentTypeDefault.new(:extension => 'rels',
50
- :content_type => 'application/vnd.openxmlformats-package.relationships+xml' )
51
-
52
- defaults << RubyXL::ContentTypeDefault.new(:extension => 'xml',
53
- :content_type => 'application/xml' )
54
-
55
- # TODO: Need to only write these types when respective content is actually present.
56
- defaults << RubyXL::ContentTypeDefault.new(:extension => 'jpeg', :content_type => 'image/jpeg')
57
- defaults << RubyXL::ContentTypeDefault.new(:extension => 'png', :content_type => 'image/png')
58
- defaults << RubyXL::ContentTypeDefault.new(:extension => 'wmf', :content_type => 'image/x-wmf')
59
- defaults << RubyXL::ContentTypeDefault.new(:extension => 'vml', :content_type => 'application/vnd.openxmlformats-officedocument.vmlDrawing')
35
+ content_types_by_ext = {}
36
+
37
+ # Collect all extensions and corresponding content types
38
+ root.rels_hash.each_pair { |klass, objects|
39
+ objects.each { |obj|
40
+ next unless klass.const_defined?(:CONTENT_TYPE)
41
+ ext = obj.xlsx_path.extname[1..-1]
42
+ next if ext.nil?
43
+ content_types_by_ext[ext] ||= []
44
+ content_types_by_ext[ext] << klass::CONTENT_TYPE
45
+ }
46
+ }
47
+
48
+ self.defaults = [ RubyXL::ContentTypeDefault.new(:extension => 'xml', :content_type => 'application/xml') ]
49
+
50
+ # Determine which content types are used most often, and add them to the list of defaults
51
+ content_types_by_ext.each_pair { |ext, content_types_arr|
52
+ next if ext.nil? || defaults.any? { |d| d.extension == ext }
53
+
54
+ counter = {} # Count the number of occurrences of a given +content_type+.
55
+ content_types_arr.each { |ct| counter[ct] = (counter[ct] || 0) + 1 }
56
+ most_used_content_type = counter.to_a.max_by{ |pair| pair.last }.first
57
+
58
+ defaults << RubyXL::ContentTypeDefault.new(:extension => ext,
59
+ :content_type => most_used_content_type)
60
+ }
61
+
62
+ self.overrides = []
63
+
64
+ # Add overrides for the files with known extensions but different content types.
65
+ root.rels_hash.each_pair { |klass, objects|
66
+ objects.each { |obj|
67
+ next unless defined?(klass::CONTENT_TYPE)
68
+ ext = obj.xlsx_path.extname[1..-1]
69
+ next if ext.nil?
70
+ next if defaults.any? { |d| (d.content_type == klass::CONTENT_TYPE) && (d.extension == ext) }
71
+ overrides << RubyXL::ContentTypeOverride.new(:part_name => obj.xlsx_path,
72
+ :content_type => klass::CONTENT_TYPE)
73
+ }
74
+ }
60
75
 
61
76
  true
62
77
  end
@@ -52,27 +52,37 @@ module RubyXL
52
52
  def add_part_title(name)
53
53
  titles_of_parts.vt_vector.vt_lpstr << RubyXL::StringNode.new(:value => name)
54
54
  end
55
- private :add_parts_count
55
+ private :add_part_title
56
56
 
57
57
  def before_write_xml
58
- if @workbook then
59
- self.heading_pairs = RubyXL::VectorValue.new(:vt_vector => RubyXL::Vector.new(:base_type => 'variant'))
60
- self.titles_of_parts = RubyXL::VectorValue.new(:vt_vector => RubyXL::Vector.new(:base_type => 'lpstr'))
58
+ workbook = root.workbook
59
+
60
+ self.heading_pairs = RubyXL::VectorValue.new(:vt_vector => RubyXL::Vector.new(:base_type => 'variant'))
61
+ self.titles_of_parts = RubyXL::VectorValue.new(:vt_vector => RubyXL::Vector.new(:base_type => 'lpstr'))
61
62
 
62
- add_parts_count('Worksheets', @workbook.worksheets.size)
63
- @workbook.worksheets.each { |sheet| add_part_title(sheet.sheet_name) }
63
+ worksheets = chartsheets = 0
64
64
 
65
- if @workbook.defined_names then
66
- add_parts_count('Named Ranges', @workbook.defined_names.size)
67
- @workbook.defined_names.each { |defined_name| add_part_title(defined_name.name) }
65
+ workbook.worksheets.each { |sheet|
66
+ add_part_title(sheet.sheet_name)
67
+
68
+ case sheet
69
+ when RubyXL::Worksheet then worksheets += 1
70
+ when RubyXL::Chartsheet then chartsheets += 1
68
71
  end
72
+ }
73
+ add_parts_count('Worksheets', worksheets) if worksheets > 0
74
+ add_parts_count('Charts', chartsheets) if chartsheets > 0
75
+
76
+ if workbook.defined_names then
77
+ add_parts_count('Named Ranges', workbook.defined_names.size)
78
+ workbook.defined_names.each { |defined_name| add_part_title(defined_name.name) }
69
79
  end
70
80
 
71
81
  true
72
82
  end
73
83
 
74
84
  def xlsx_path
75
- File.join('docProps', 'app.xml')
85
+ ROOT.join('docProps', 'app.xml')
76
86
  end
77
87
 
78
88
  end
@@ -109,7 +119,7 @@ module RubyXL
109
119
  define_element_name 'cp:coreProperties'
110
120
 
111
121
  def xlsx_path
112
- File.join('docProps', 'core.xml')
122
+ ROOT.join('docProps', 'core.xml')
113
123
  end
114
124
 
115
125
  def creator
@@ -27,7 +27,7 @@ module RubyXL
27
27
 
28
28
  # http://www.schemacentral.com/sc/ooxml/e-ssml_top10-1.html
29
29
  class Top10 < OOXMLObject
30
- define_attribute(:top, :bool, :default => true)
30
+ define_attribute(:top, :bool, :default => true)
31
31
  define_attribute(:percent, :bool, :default => false)
32
32
  define_attribute(:val, :double, :required => true)
33
33
  define_attribute(:filterVal, :double)
@@ -74,7 +74,7 @@ module RubyXL
74
74
  class AutoFilterColumn < OOXMLObject
75
75
  define_attribute(:colId, :int, :required => true)
76
76
  define_attribute(:hiddenButton, :bool, :default => false)
77
- define_attribute(:showButton, :bool, :default => true)
77
+ define_attribute(:showButton, :bool, :default => true)
78
78
  define_child_node(RubyXL::FilterContainer)
79
79
  define_child_node(RubyXL::Top10)
80
80
  define_child_node(RubyXL::CustomFilters)
@@ -101,7 +101,7 @@ module RubyXL
101
101
  define_element_name 'fonts'
102
102
 
103
103
  def self.defaults
104
- self.new(:_ => [
104
+ self.new(:_ => [
105
105
  RubyXL::Font.new(:name => RubyXL::StringValue.new(:val => 'Verdana'),
106
106
  :sz => RubyXL::FloatValue.new(:val => 10) ),
107
107
  RubyXL::Font.new(:name => RubyXL::StringValue.new(:val => 'Verdana'),
@@ -4,14 +4,14 @@ module RubyXL
4
4
  module OOXMLObjectClassMethods
5
5
  # Get the value of a [sub]class variable if it exists, or create the respective variable
6
6
  # with the passed-in +default+ (or +{}+, if not specified)
7
- #
7
+ #
8
8
  # Throughout this class, we are setting class variables through explicit method calls
9
9
  # rather than by directly addressing the name of the variable because of context issues:
10
10
  # addressing variable by name creates it in the context of defining class, while calling
11
- # the setter/getter method addresses it in the context of descendant class,
11
+ # the setter/getter method addresses it in the context of descendant class,
12
12
  # which is what we need.
13
13
  def obtain_class_variable(var_name, default = {})
14
- if class_variable_defined?(var_name) then
14
+ if class_variable_defined?(var_name) then
15
15
  self.class_variable_get(var_name)
16
16
  else
17
17
  self.class_variable_set(var_name, default)
@@ -52,7 +52,7 @@ module RubyXL
52
52
  attrs[attr_name.to_s] = attr_hash
53
53
  self.send(:attr_accessor, attr_hash[:accessor]) unless attr_hash[:computed]
54
54
  end
55
-
55
+
56
56
  # Defines a child node of OOXML object.
57
57
  # === Parameters
58
58
  # * +klass+ - Class (descendant of RubyXL::OOXMLObject) of the child nodes. Child node objects will be produced by calling +parse+ method of that class.
@@ -78,7 +78,7 @@ module RubyXL
78
78
  child_node_name = (extra_params[:node_name] || klass.class_variable_get(:@@ooxml_tag_name)).to_s
79
79
  accessor = (extra_params[:accessor] || accessorize(child_node_name)).to_sym
80
80
 
81
- child_nodes[child_node_name] = {
81
+ child_nodes[child_node_name] = {
82
82
  :class => klass,
83
83
  :is_array => extra_params[:collection],
84
84
  :accessor => accessor
@@ -93,9 +93,9 @@ module RubyXL
93
93
  define_attribute(:count, :uint, :required => true)
94
94
  end
95
95
  private :define_count_attribute
96
-
96
+
97
97
  # Defines the name of the element that represents the current OOXML object. Should only be used once per object.
98
- # In case of different objects represented by the same class in different parts of OOXML tree, +:node_name+
98
+ # In case of different objects represented by the same class in different parts of OOXML tree, +:node_name+
99
99
  # extra parameter can be used to override the default element name.
100
100
  # === Parameters
101
101
  # * +element_name+
@@ -145,7 +145,7 @@ module RubyXL
145
145
  prefix = known_namespaces[ns.href] || ns.prefix
146
146
 
147
147
  child_node_name = case prefix
148
- when '', nil then child_node.name
148
+ when '', nil then child_node.name
149
149
  else "#{prefix}:#{child_node.name}"
150
150
  end
151
151
 
@@ -196,7 +196,7 @@ module RubyXL
196
196
  v = Integer(raw_value)
197
197
  raise ArgumentError.new("invalid value for unsigned Integer(): \"#{raw_value}\"") if v < 0
198
198
  v
199
- end
199
+ end
200
200
  obj.send("#{params[:accessor]}=", val)
201
201
  end
202
202
 
@@ -204,6 +204,9 @@ module RubyXL
204
204
 
205
205
 
206
206
  module OOXMLObjectInstanceMethods
207
+ def self.included(klass)
208
+ klass.extend RubyXL::OOXMLObjectClassMethods
209
+ end
207
210
 
208
211
  def obtain_class_variable(var_name, default = {})
209
212
  self.class.obtain_class_variable(var_name, default)
@@ -234,7 +237,7 @@ module RubyXL
234
237
  end
235
238
  private :init_child_nodes
236
239
 
237
- # Recursively write the OOXML object and all its children out as Nokogiri::XML. Immediately before the actual
240
+ # Recursively write the OOXML object and all its children out as Nokogiri::XML. Immediately before the actual
238
241
  # generation, +before_write_xml()+ is called to perform last-minute cleanup and validation operations; if it
239
242
  # returns +false+, an empty string is returned (rather than +nil+, so Nokogiri::XML's <tt>&lt;&lt;</tt> operator
240
243
  # can be used without additional +nil+ checking)
@@ -290,7 +293,7 @@ module RubyXL
290
293
  node_obj = get_node_object(child_node_params)
291
294
  next if node_obj.nil?
292
295
 
293
- if node_obj.respond_to?(:write_xml) && !node_obj.equal?(self) then
296
+ if node_obj.respond_to?(:write_xml) && !node_obj.equal?(self) then
294
297
  # If child node is either +OOXMLObject+, or +OOXMLContainerObject+ on its first (envelope) pass,
295
298
  # serialize that object.
296
299
  elem << node_obj.write_xml(xml, child_node_name)
@@ -310,7 +313,7 @@ module RubyXL
310
313
  end
311
314
 
312
315
  # Prototype method. For sparse collections (+Rows+, +Cells+, etc.) must return index at which this object
313
- # is expected to reside in the collection. If +nil+ is returned, then object is simply added
316
+ # is expected to reside in the collection. If +nil+ is returned, then object is simply added
314
317
  # to the end of the collection.
315
318
  def index_in_collection
316
319
  nil
@@ -330,7 +333,7 @@ module RubyXL
330
333
  child_nodes.each_pair { |child_node_name, child_node_params|
331
334
  self.count = self.send(child_node_params[:accessor]).size if child_node_params[:is_array] == :with_count
332
335
  }
333
- true
336
+ true
334
337
  end
335
338
 
336
339
  end
@@ -340,7 +343,6 @@ module RubyXL
340
343
  # and marshalling them to XML.
341
344
  class OOXMLObject
342
345
  include OOXMLObjectInstanceMethods
343
- extend OOXMLObjectClassMethods
344
346
  end
345
347
 
346
348
  # Parent class for OOXML conainer objects (for example,
@@ -348,7 +350,6 @@ module RubyXL
348
350
  # that obscures the top-level container, allowing direct access to the contents as +Array+.
349
351
  class OOXMLContainerObject < Array
350
352
  include OOXMLObjectInstanceMethods
351
- extend OOXMLObjectClassMethods
352
353
 
353
354
  def initialize(params = {})
354
355
  array_content = params.delete(:_)
@@ -395,6 +396,9 @@ module RubyXL
395
396
  # their own <tt>.xml</tt> files in <tt>.xslx</tt> zip container.
396
397
  class OOXMLTopLevelObject < OOXMLObject
397
398
  SAVE_ORDER = 500
399
+ ROOT = ::Pathname.new('/')
400
+
401
+ attr_accessor :root
398
402
 
399
403
  # Prototype method. For top-level OOXML object, returns the path at which the current object's XML file
400
404
  # is located within the <tt>.xslx</tt> zip container.
@@ -417,7 +421,7 @@ module RubyXL
417
421
  # === Parameters
418
422
  # * +dirpath+ - path to the directory with the unzipped <tt>.xslx</tt> contents.
419
423
  def self.parse_file(dirpath, file_path = nil)
420
- file_path = ::Pathname.new(file_path || self.xlsx_path)
424
+ file_path = file_path || self.xlsx_path
421
425
 
422
426
  case dirpath
423
427
  when String then
@@ -439,12 +443,12 @@ module RubyXL
439
443
  def add_to_zip(zip_stream)
440
444
  xml_string = write_xml
441
445
  return if xml_string.empty?
442
- zip_stream.put_next_entry(self.xlsx_path)
446
+ zip_stream.put_next_entry(self.xlsx_path.relative_path_from(::Pathname.new("/")))
443
447
  zip_stream.write(xml_string)
444
448
  end
445
449
 
446
450
  def file_index
447
- @workbook.root.rels_hash[self.class].index{ |f| f.equal?(self) }.to_i + 1
451
+ root.rels_hash[self.class].index{ |f| f.equal?(self) }.to_i + 1
448
452
  end
449
453
 
450
454
  end
@@ -19,7 +19,7 @@ module RubyXL
19
19
  from, to = params[0].split(':')
20
20
  row_from, col_from = self.class.ref2ind(from)
21
21
  row_to, col_to = self.class.ref2ind(to) unless to.nil?
22
- end
22
+ end
23
23
 
24
24
  @row_range = Range.new(row_from || 0, row_to || row_from || ROW_MAX)
25
25
  @col_range = Range.new(col_from || 0, col_to || col_from || COL_MAX)
@@ -50,7 +50,7 @@ module RubyXL
50
50
  end
51
51
 
52
52
  def cover?(other)
53
- !other.nil? && (@row_range.cover?(other.row_range.begin) && @row_range.cover?(other.row_range.end) &&
53
+ !other.nil? && (@row_range.cover?(other.row_range.begin) && @row_range.cover?(other.row_range.end) &&
54
54
  @col_range.cover?(other.col_range.begin) && @col_range.cover?(other.col_range.end))
55
55
  end
56
56
 
@@ -92,7 +92,7 @@ module RubyXL
92
92
  col = 0
93
93
  $1.each_byte { |chr| col = col * 26 + (chr - 64) }
94
94
  [ $2.to_i - 1, col - 1 ]
95
- end
95
+ end
96
96
 
97
97
  end
98
98
 
@@ -15,7 +15,8 @@ module RubyXL
15
15
  end
16
16
 
17
17
  class OOXMLRelationshipsFile < OOXMLTopLevelObject
18
- SAVE_ORDER = 0
18
+ CONTENT_TYPE = 'application/vnd.openxmlformats-package.relationships+xml'
19
+ SAVE_ORDER = 100
19
20
 
20
21
  define_child_node(RubyXL::Relationship, :collection => true, :accessor => :relationships)
21
22
  define_element_name 'Relationships'
@@ -26,17 +27,21 @@ module RubyXL
26
27
  @@debug = nil # Change to 0 to enable debug output
27
28
 
28
29
  def new_relationship(target, type)
29
- RubyXL::Relationship.new(:id => "rId#{relationships.size + 1}",
30
+ RubyXL::Relationship.new(:id => "rId#{relationships.size + 1}",
30
31
  :type => type,
31
32
  :target => target)
32
33
  end
33
34
  protected :new_relationship
34
35
 
35
36
  def add_relationship(obj)
36
- return if obj.nil?
37
- relationships << RubyXL::Relationship.new(:id => "rId#{relationships.size + 1}",
37
+ return if obj.nil? || !defined?(obj.class::REL_TYPE)
38
+
39
+ file_path = Pathname.new(obj.xlsx_path)
40
+ owner_path = Pathname.new(owner.xlsx_path)
41
+
42
+ relationships << RubyXL::Relationship.new(:id => "rId#{relationships.size + 1}",
38
43
  :type => obj.class::REL_TYPE,
39
- :target => obj.xlsx_path)
44
+ :target => file_path.relative_path_from(owner_path.dirname))
40
45
  end
41
46
  protected :add_relationship
42
47
 
@@ -45,7 +50,9 @@ module RubyXL
45
50
  end
46
51
 
47
52
  def find_by_target(target)
48
- relationships.find { |r| r.target == target }
53
+ relationships.find { |r|
54
+ (r.target == target) || (r.target == target.relative_path_from(owner.xlsx_path.dirname))
55
+ }
49
56
  end
50
57
 
51
58
  def self.get_class_by_rel_type(rel_type)
@@ -63,7 +70,7 @@ module RubyXL
63
70
  @@rel_hash[rel_type]
64
71
  end
65
72
 
66
- def load_related_files(zipdir_path, base_file_name = '')
73
+ def load_related_files(zipdir_path, base_file_name)
67
74
  self.related_files = {}
68
75
 
69
76
  @@debug +=2 if @@debug
@@ -74,7 +81,7 @@ module RubyXL
74
81
  file_path = Pathname.new(rel.target)
75
82
 
76
83
  if !file_path.absolute? then
77
- file_path = (Pathname.new(File.dirname(base_file_name)) + file_path).cleanpath
84
+ file_path = (base_file_name.dirname + file_path).cleanpath
78
85
  end
79
86
 
80
87
  klass = RubyXL::OOXMLRelationshipsFile.get_class_by_rel_type(rel.type)
@@ -97,7 +104,7 @@ module RubyXL
97
104
  end
98
105
 
99
106
  def self.load_relationship_file(zipdir_path, base_file_path)
100
- rel_file_path = Pathname.new(File.join(File.dirname(base_file_path), '_rels', File.basename(base_file_path) + '.rels')).cleanpath
107
+ rel_file_path = rel_file_path(base_file_path)
101
108
 
102
109
  puts "--> DEBUG: #{' ' * @@debug}Loading .rel file: #{rel_file_path}" if @@debug
103
110
 
@@ -105,72 +112,30 @@ module RubyXL
105
112
  end
106
113
 
107
114
  def xlsx_path
108
- file_path = owner.xlsx_path
109
- File.join(File.dirname(file_path), '_rels', File.basename(file_path) + '.rels')
115
+ self.class.rel_file_path(owner.xlsx_path)
110
116
  end
111
117
 
112
- end
113
-
114
- class WorkbookRelationships < OOXMLRelationshipsFile
115
-
116
- attr_accessor :workbook
117
-
118
118
  def before_write_xml
119
- self.relationships = []
120
-
121
- @workbook.worksheets.each_with_index { |sheet, i|
122
- relationships << new_relationship(sheet.xlsx_path.gsub(/\Axl\//, ''), sheet.class::REL_TYPE)
123
- }
124
-
125
- # @workbook.external_links.each_key { |k|
126
- # relationships << new_relationship("externalLinks/#{k}", 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLink')
127
- # }
128
-
129
- relationships << new_relationship('theme/theme1.xml', @workbook.theme.class::REL_TYPE) if @workbook.theme
130
- relationships << new_relationship('styles.xml', @workbook.stylesheet.class::REL_TYPE) if @workbook.stylesheet
131
-
132
- if @workbook.shared_strings_container && !@workbook.shared_strings_container.strings.empty? then
133
- relationships << new_relationship('sharedStrings.xml', @workbook.shared_strings_container.class::REL_TYPE)
119
+ case owner
120
+ when RubyXL::WorkbookRoot, RubyXL::Workbook then
121
+ # Fully implemented objects with no generic (unhandled) relationships -
122
+ # (re)generating relationships from scratch.
123
+ related_objects = owner.related_objects
124
+ related_objects += owner.generic_storage if owner.generic_storage
125
+
126
+ self.relationships = []
127
+ related_objects.compact.each { |f| add_relationship(f) }
134
128
  end
135
-
136
- if @workbook.calculation_chain && !@workbook.calculation_chain.cells.empty? then
137
- relationships << new_relationship('calcChain.xml', @workbook.calculation_chain.class::REL_TYPE)
138
- end
139
-
140
- true
129
+ super
141
130
  end
142
131
 
143
- end
144
-
145
- class RootRelationships < OOXMLRelationshipsFile
146
-
147
- def before_write_xml
148
- self.relationships = []
149
-
150
- add_relationship(owner.workbook)
151
- add_relationship(owner.thumbnail)
152
- add_relationship(owner.core_properties)
153
- add_relationship(owner.document_properties)
154
-
155
- true
156
- end
157
-
158
- def xlsx_path
159
- File.join('_rels', '.rels')
132
+ def self.rel_file_path(base_file_path)
133
+ basename = base_file_path.root? ? '' : base_file_path.basename
134
+ base_file_path.dirname.join('_rels', "#{basename}.rels").cleanpath
160
135
  end
161
- end
162
136
 
163
- class SheetRelationshipsFile < OOXMLRelationshipsFile
164
- # Insert class specific stuff here once we get to implementing it
165
137
  end
166
138
 
167
- class DrawingRelationshipsFile < OOXMLRelationshipsFile
168
- # Insert class specific stuff here once we get to implementing it
169
- end
170
-
171
- class ChartRelationshipsFile < OOXMLRelationshipsFile
172
- # Insert class specific stuff here once we get to implementing it
173
- end
174
139
 
175
140
  module RelationshipSupport
176
141
 
@@ -183,7 +148,7 @@ module RubyXL
183
148
 
184
149
  def self.included(klass)
185
150
  klass.class_variable_set(:@@ooxml_relationships, {})
186
- klass.extend RelationshipSupport::ClassMehods
151
+ klass.extend RubyXL::RelationshipSupport::ClassMehods
187
152
  end
188
153
 
189
154
  attr_accessor :generic_storage, :relationship_container
@@ -194,7 +159,6 @@ module RubyXL
194
159
 
195
160
  def collect_related_objects
196
161
  res = related_objects.compact # Avoid tainting +related_objects+ array
197
-
198
162
  res += generic_storage if generic_storage
199
163
 
200
164
  if relationship_container then
@@ -207,8 +171,8 @@ module RubyXL
207
171
  res
208
172
  end
209
173
 
210
- def load_relationships(dir_path, base_file_name = '')
211
- self.relationship_container = self.class.const_get(:REL_CLASS).load_relationship_file(dir_path, base_file_name)
174
+ def load_relationships(dir_path, base_file_name)
175
+ self.relationship_container = RubyXL::OOXMLRelationshipsFile.load_relationship_file(dir_path, base_file_name)
212
176
  return if relationship_container.nil?
213
177
 
214
178
  relationship_container.load_related_files(dir_path, base_file_name).each_pair { |rid, related_file|
@@ -235,7 +199,7 @@ module RubyXL
235
199
  end
236
200
  else store_relationship(rf, :unknown)
237
201
  end
238
- end
202
+ end
239
203
 
240
204
  def store_relationship(related_file, unknown = false)
241
205
  self.generic_storage ||= []