axlsx 1.0.7 → 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (207) hide show
  1. data/README.md +21 -3
  2. data/doc/Axlsx.html +150 -6
  3. data/doc/Axlsx/App.html +1 -1
  4. data/doc/Axlsx/Axis.html +1 -1
  5. data/doc/Axlsx/Bar3DChart.html +1 -1
  6. data/doc/Axlsx/BarSeries.html +1 -1
  7. data/doc/Axlsx/Border.html +1 -1
  8. data/doc/Axlsx/BorderPr.html +1 -1
  9. data/doc/Axlsx/CatAxis.html +1 -1
  10. data/doc/Axlsx/CatAxisData.html +7 -5
  11. data/doc/Axlsx/Cell.html +1 -1
  12. data/doc/Axlsx/CellAlignment.html +1 -1
  13. data/doc/Axlsx/CellProtection.html +1 -1
  14. data/doc/Axlsx/CellStyle.html +1 -1
  15. data/doc/Axlsx/Chart.html +16 -16
  16. data/doc/Axlsx/Color.html +1 -1
  17. data/doc/Axlsx/ContentType.html +1 -1
  18. data/doc/Axlsx/Core.html +1 -1
  19. data/doc/Axlsx/DataTypeValidator.html +1 -1
  20. data/doc/Axlsx/Default.html +1 -1
  21. data/doc/Axlsx/Drawing.html +243 -65
  22. data/doc/Axlsx/Fill.html +1 -1
  23. data/doc/Axlsx/Font.html +1 -1
  24. data/doc/Axlsx/GradientFill.html +1 -1
  25. data/doc/Axlsx/GradientStop.html +1 -1
  26. data/doc/Axlsx/GraphicFrame.html +21 -21
  27. data/doc/Axlsx/Line3DChart.html +1 -1
  28. data/doc/Axlsx/LineSeries.html +6 -8
  29. data/doc/Axlsx/Marker.html +1 -1
  30. data/doc/Axlsx/NumFmt.html +1 -1
  31. data/doc/Axlsx/OneCellAnchor.html +988 -0
  32. data/doc/Axlsx/Override.html +1 -1
  33. data/doc/Axlsx/Package.html +127 -75
  34. data/doc/Axlsx/PatternFill.html +1 -1
  35. data/doc/Axlsx/Pic.html +1532 -0
  36. data/doc/Axlsx/Pie3DChart.html +5 -7
  37. data/doc/Axlsx/PieSeries.html +1 -1
  38. data/doc/Axlsx/RegexValidator.html +1 -1
  39. data/doc/Axlsx/Relationship.html +6 -6
  40. data/doc/Axlsx/Relationships.html +1 -1
  41. data/doc/Axlsx/RestrictionValidator.html +1 -1
  42. data/doc/Axlsx/Row.html +1 -1
  43. data/doc/Axlsx/Scaling.html +1 -1
  44. data/doc/Axlsx/SerAxis.html +1 -1
  45. data/doc/Axlsx/Series.html +1 -1
  46. data/doc/Axlsx/SeriesTitle.html +1 -1
  47. data/doc/Axlsx/SimpleTypedList.html +1 -1
  48. data/doc/Axlsx/Styles.html +1 -1
  49. data/doc/Axlsx/TableStyle.html +1 -1
  50. data/doc/Axlsx/TableStyleElement.html +1 -1
  51. data/doc/Axlsx/TableStyles.html +1 -1
  52. data/doc/Axlsx/Title.html +1 -1
  53. data/doc/Axlsx/TwoCellAnchor.html +165 -61
  54. data/doc/Axlsx/ValAxis.html +1 -1
  55. data/doc/Axlsx/ValAxisData.html +1 -1
  56. data/doc/Axlsx/View3D.html +1 -1
  57. data/doc/Axlsx/Workbook.html +151 -47
  58. data/doc/Axlsx/Worksheet.html +172 -35
  59. data/doc/Axlsx/Xf.html +1 -1
  60. data/doc/_index.html +15 -1
  61. data/doc/class_list.html +1 -1
  62. data/doc/file.README.html +29 -4
  63. data/doc/index.html +29 -4
  64. data/doc/method_list.html +571 -363
  65. data/doc/top-level-namespace.html +1 -1
  66. data/examples/example.rb +13 -0
  67. data/examples/image1.gif +0 -0
  68. data/examples/image1.jpeg +0 -0
  69. data/examples/image1.jpg +0 -0
  70. data/examples/image1.png +0 -0
  71. data/lib/axlsx/drawing/bar_series.rb +0 -1
  72. data/lib/axlsx/drawing/cat_axis_data.rb +1 -0
  73. data/lib/axlsx/drawing/chart.rb +0 -1
  74. data/lib/axlsx/drawing/drawing.rb +31 -7
  75. data/lib/axlsx/drawing/graphic_frame.rb +0 -2
  76. data/lib/axlsx/drawing/line_series.rb +0 -1
  77. data/lib/axlsx/drawing/one_cell_anchor.rb +89 -0
  78. data/lib/axlsx/drawing/pic.rb +158 -0
  79. data/lib/axlsx/drawing/pie_3D_chart.rb +0 -1
  80. data/lib/axlsx/drawing/two_cell_anchor.rb +17 -4
  81. data/lib/axlsx/package.rb +31 -5
  82. data/lib/axlsx/rels/relationship.rb +1 -2
  83. data/lib/axlsx/util/constants.rb +24 -0
  84. data/lib/axlsx/util/validators.rb +2 -2
  85. data/lib/axlsx/version.rb +1 -1
  86. data/lib/axlsx/workbook/workbook.rb +8 -0
  87. data/lib/axlsx/workbook/worksheet/worksheet.rb +10 -1
  88. data/test/drawing/tc_drawing.rb +10 -1
  89. data/test/drawing/tc_one_cell_anchor.rb +67 -0
  90. data/test/drawing/tc_pic.rb +71 -0
  91. data/test/tc_package.rb +0 -2
  92. metadata +13 -118
  93. data/examples/#example.rb# +0 -87
  94. data/examples/example.rb~ +0 -79
  95. data/examples/multi_chart.xlsx +0 -0
  96. data/lib/axlsx.rb~ +0 -67
  97. data/lib/axlsx/content_type/content_type.rb~ +0 -20
  98. data/lib/axlsx/content_type/default.rb~ +0 -32
  99. data/lib/axlsx/content_type/override.rb~ +0 -30
  100. data/lib/axlsx/doc_props/app.rb~ +0 -127
  101. data/lib/axlsx/doc_props/core.rb~ +0 -25
  102. data/lib/axlsx/drawing/#bar_series.rb# +0 -62
  103. data/lib/axlsx/drawing/axis.rb~ +0 -0
  104. data/lib/axlsx/drawing/bar_3D_chart.rb~ +0 -64
  105. data/lib/axlsx/drawing/bar_series.rb~ +0 -92
  106. data/lib/axlsx/drawing/cat_axis.rb~ +0 -32
  107. data/lib/axlsx/drawing/cat_axis_data.rb~ +0 -28
  108. data/lib/axlsx/drawing/chart.rb~ +0 -0
  109. data/lib/axlsx/drawing/drawing.rb~ +0 -102
  110. data/lib/axlsx/drawing/graphic_frame.rb~ +0 -40
  111. data/lib/axlsx/drawing/line_3D_chart.rb~ +0 -138
  112. data/lib/axlsx/drawing/line_series.rb~ +0 -91
  113. data/lib/axlsx/drawing/marker.rb~ +0 -50
  114. data/lib/axlsx/drawing/pie_3D_chart.rb~ +0 -132
  115. data/lib/axlsx/drawing/pie_series.rb~ +0 -0
  116. data/lib/axlsx/drawing/scaling.rb~ +0 -0
  117. data/lib/axlsx/drawing/ser_axis.rb~ +0 -48
  118. data/lib/axlsx/drawing/series.rb~ +0 -114
  119. data/lib/axlsx/drawing/series_title.rb~ +0 -18
  120. data/lib/axlsx/drawing/title.rb~ +0 -69
  121. data/lib/axlsx/drawing/two_cell_anchor.rb~ +0 -70
  122. data/lib/axlsx/drawing/val_axis.rb~ +0 -34
  123. data/lib/axlsx/drawing/val_axis_data.rb~ +0 -29
  124. data/lib/axlsx/drawing/view_3D.rb~ +0 -21
  125. data/lib/axlsx/package.rb~ +0 -181
  126. data/lib/axlsx/rels/relationship.rb~ +0 -18
  127. data/lib/axlsx/rels/relationships.rb~ +0 -23
  128. data/lib/axlsx/stylesheet/border.rb~ +0 -24
  129. data/lib/axlsx/stylesheet/border_pr.rb~ +0 -64
  130. data/lib/axlsx/stylesheet/cell_alignment.rb~ +0 -93
  131. data/lib/axlsx/stylesheet/cell_protection.rb~ +0 -16
  132. data/lib/axlsx/stylesheet/cell_style.rb~ +0 -61
  133. data/lib/axlsx/stylesheet/color.rb~ +0 -56
  134. data/lib/axlsx/stylesheet/fill.rb~ +0 -31
  135. data/lib/axlsx/stylesheet/font.rb~ +0 -33
  136. data/lib/axlsx/stylesheet/gradient_fill.rb~ +0 -70
  137. data/lib/axlsx/stylesheet/gradient_stop.rb~ +0 -15
  138. data/lib/axlsx/stylesheet/num_fmt.rb~ +0 -60
  139. data/lib/axlsx/stylesheet/pattern_fill.rb~ +0 -63
  140. data/lib/axlsx/stylesheet/styles.rb~ +0 -279
  141. data/lib/axlsx/stylesheet/table_style.rb~ +0 -43
  142. data/lib/axlsx/stylesheet/table_style_element.rb~ +0 -66
  143. data/lib/axlsx/stylesheet/table_styles.rb~ +0 -36
  144. data/lib/axlsx/stylesheet/xf.rb~ +0 -37
  145. data/lib/axlsx/util/constants.rb~ +0 -187
  146. data/lib/axlsx/util/monkey_patches_for_true_zip_stream.rb~ +0 -61
  147. data/lib/axlsx/util/simple_typed_list.rb~ +0 -79
  148. data/lib/axlsx/util/validators.rb~ +0 -132
  149. data/lib/axlsx/util/xml_escape.rb~ +0 -6
  150. data/lib/axlsx/workbook/workbook.rb~ +0 -130
  151. data/lib/axlsx/workbook/worksheet/cell.rb~ +0 -185
  152. data/lib/axlsx/workbook/worksheet/row.rb~ +0 -92
  153. data/lib/axlsx/workbook/worksheet/worksheet.rb~ +0 -194
  154. data/test/content_type/tc_content_type.rb~ +0 -81
  155. data/test/content_type/tc_default.rb~ +0 -40
  156. data/test/content_type/tc_override.rb~ +0 -40
  157. data/test/doc_props/tc_app.rb~ +0 -19
  158. data/test/drawing/tc_axis.rb~ +0 -0
  159. data/test/drawing/tc_bar_3D_chart.rb~ +0 -66
  160. data/test/drawing/tc_bar_series.rb~ +0 -31
  161. data/test/drawing/tc_cat_axis.rb~ +0 -39
  162. data/test/drawing/tc_cat_axis_data.rb~ +0 -32
  163. data/test/drawing/tc_chart.rb~ +0 -59
  164. data/test/drawing/tc_graphic_frame.rb~ +0 -21
  165. data/test/drawing/tc_line_3d_chart.rb~ +0 -48
  166. data/test/drawing/tc_line_series.rb~ +0 -34
  167. data/test/drawing/tc_marker.rb~ +0 -26
  168. data/test/drawing/tc_pie_3D_chart.rb~ +0 -33
  169. data/test/drawing/tc_pie_series.rb~ +0 -26
  170. data/test/drawing/tc_scaling.rb~ +0 -45
  171. data/test/drawing/tc_ser_axis.rb~ +0 -20
  172. data/test/drawing/tc_series.rb~ +0 -31
  173. data/test/drawing/tc_series_title.rb~ +0 -34
  174. data/test/drawing/tc_title.rb~ +0 -34
  175. data/test/drawing/tc_two_cell_anchor.rb~ +0 -37
  176. data/test/drawing/tc_val_axis.rb~ +0 -32
  177. data/test/drawing/tc_val_axis_data.rb~ +0 -18
  178. data/test/drawing/tc_view_3D.rb~ +0 -37
  179. data/test/rels/tc_relationship.rb~ +0 -39
  180. data/test/rels/tc_relationships.rb~ +0 -37
  181. data/test/stylesheet/tc_border.rb~ +0 -31
  182. data/test/stylesheet/tc_border_pr.rb~ +0 -31
  183. data/test/stylesheet/tc_cell_alignment.rb~ +0 -38
  184. data/test/stylesheet/tc_cell_protection.rb~ +0 -77
  185. data/test/stylesheet/tc_cell_style.rb~ +0 -30
  186. data/test/stylesheet/tc_color.rb~ +0 -38
  187. data/test/stylesheet/tc_fill.rb~ +0 -19
  188. data/test/stylesheet/tc_font.rb~ +0 -19
  189. data/test/stylesheet/tc_gradient_fill.rb~ +0 -114
  190. data/test/stylesheet/tc_gradient_stop.rb~ +0 -65
  191. data/test/stylesheet/tc_num_fmt.rb~ +0 -32
  192. data/test/stylesheet/tc_pattern_fill.rb~ +0 -31
  193. data/test/stylesheet/tc_table_style.rb~ +0 -38
  194. data/test/stylesheet/tc_table_style_element.rb~ +0 -37
  195. data/test/stylesheet/tc_table_styles.rb~ +0 -37
  196. data/test/stylesheet/tc_xf.rb~ +0 -30
  197. data/test/tc_app.rb~ +0 -19
  198. data/test/tc_border_pr.rb~ +0 -21
  199. data/test/tc_package.rb~ +0 -64
  200. data/test/tc_pie_3D_chart.rb~ +0 -66
  201. data/test/tc_relationships.rb~ +0 -37
  202. data/test/tc_series.rb~ +0 -31
  203. data/test/tc_styles.rb~ +0 -64
  204. data/test/tc_validators.rb~ +0 -77
  205. data/test/tc_worksheet.rb~ +0 -85
  206. data/test/workbook/worksheet/tc_row.rb~ +0 -30
  207. data/test/workbook/worksheet/tc_worksheet.rb~ +0 -85
@@ -1,66 +0,0 @@
1
- module Axlsx
2
- # an element of style that belongs to a table style.
3
- # @note tables and table styles are not supported in this version. This class exists in preparation for that support.
4
- class TableStyleElement
5
- # The type of style element. The following type are allowed
6
- # :wholeTable
7
- # :headerRow
8
- # :totalRow
9
- # :firstColumn
10
- # :lastColumn
11
- # :firstRowStripe
12
- # :secondRowStripe
13
- # :firstColumnStripe
14
- # :secondColumnStripe
15
- # :firstHeaderCell
16
- # :lastHeaderCell
17
- # :firstTotalCell
18
- # :lastTotalCell
19
- # :firstSubtotalColumn
20
- # :secondSubtotalColumn
21
- # :thirdSubtotalColumn
22
- # :firstSubtotalRow
23
- # :secondSubtotalRow
24
- # :thirdSubtotalRow
25
- # :blankRow
26
- # :firstColumnSubheading
27
- # :secondColumnSubheading
28
- # :thirdColumnSubheading
29
- # :firstRowSubheading
30
- # :secondRowSubheading
31
- # :thirdRowSubheading
32
- # :pageFieldLabels
33
- # :pageFieldValues
34
- # @return [Symbol]
35
- attr_accessor :type
36
-
37
- # Number of rows or columns used in striping when the type is firstRowStripe, secondRowStripe, firstColumnStripe, or secondColumnStripe.
38
- # @return [Integer]
39
- attr_accessor :size
40
-
41
- # The dxfId this style element points to
42
- # @return [Integer]
43
- attr_accessor :dxfId
44
-
45
- # creates a new TableStyleElement object
46
- # @option options [Symbol] type
47
- # @option options [Integer] size
48
- # @option options [Integer] dxfId
49
- def initialize(options={})
50
- options.each do |o|
51
- self.send("#{o[0]}=", o[1]) if self.respond_to? o[0]
52
- end
53
- end
54
-
55
- def type=(v) Axlsx::validate_table_element_type v; @type = v end
56
- def size=(v) Axlsx::validate_unsigned_int v; @size = v end
57
- def dxfId=(v) Axlsx::validate_unsigned_int v; @dxfIt = v end
58
-
59
- # Serializes the table style element
60
- # @param [Nokogiri::XML::Builder] xml The document builder instance this objects xml will be added to.
61
- # @return [String]
62
- def to_xml(xml)
63
- xml.tableStyleElement self.instance_values
64
- end
65
- end
66
- end
@@ -1,36 +0,0 @@
1
- module Axlsx
2
- # TableStyles represents a collection of style definitions for table styles and pivot table styles.
3
- # @note Support for custom table styles does not exist in this version. Many of the classes required are defined in preparation for future release. Please do not attempt to add custom table styles.
4
- class TableStyles < SimpleTypedList
5
-
6
- # The default table style. The default value is 'TableStyleMedium9'
7
- # @return [String]
8
- #
9
- attr_accessor :defaultTableStyle
10
-
11
- # The default pivot table style. The default value is 'PivotStyleLight6'
12
- # @return [String]
13
- attr_accessor :defaultPivotStyle
14
-
15
- # Creates a new TableStyles object that is a container for TableStyle objects
16
- # @option options [String] defaultTableStyle
17
- # @option options [String] defaultPivotStyle
18
- def initialize(options={})
19
- @defaultTableStyle = options[:defaultTableStyle] || "TableStyleMedium9"
20
- @defaultPivotStyle = options[:defaultPivotStyle] || "PivotStyleLight16"
21
- super TableStyle
22
- end
23
-
24
- # Serializes the table styles element
25
- # @param [Nokogiri::XML::Builder] xml The document builder instance this objects xml will be added to.
26
- # @return [String]
27
- def to_xml(xml)
28
- attr = self.instance_values.reject {|k, v| ![:defaultTableStyle, :defaultPivotStyle].include?(k.to_sym) }
29
- attr[:count] = self.size
30
- xml.tableStyles(attr) {
31
- self.each { |table_style| table_style.to_xml(xml) }
32
- }
33
- end
34
- end
35
-
36
- end
@@ -1,37 +0,0 @@
1
- module Axlsx
2
- class Xf
3
- #does not support extList (ExtensionList)
4
- attr_accessor :alignment, :protection, :numFmtId, :fontId, :fillId, :borderId, :xfId, :quotePrefix, :pivotButton, :applyNumberFormat, :applyFont, :applyFill, :applyBorder, :applyAlignment, :applyProtection
5
- attr_accessor :name #this is not part of the standard - but a convenience when you want to tell a row what style to use.
6
- def initialize(options={})
7
- options.each do |o|
8
- self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
9
- end
10
- end
11
-
12
- def alignment=(v) DataTypeValidator.validate "Xf.alignment", CellAlignment, v; @alignment = v end
13
- def protection=(v) DataTypeValidator.validate "Xf.protection", CellProtection, v; @protection = v end
14
-
15
- def name=(v) Axlsx::validate_string v; @name = v end
16
- def numFmtId=(v) Axlsx::validate_unsigned_int v; @numFmtId = v end
17
- def fontId=(v) Axlsx::validate_unsigned_int v; @fontId = v end
18
- def fillId=(v) Axlsx::validate_unsigned_int v; @fillId = v end
19
- def borderId=(v) Axlsx::validate_unsigned_int v; @borderId = v end
20
- def xfId=(v) Axlsx::validate_unsigned_int v; @xfId = v end
21
- def quotePrefix=(v) Axlsx::validate_boolean v; @quotePrefix = v end
22
- def pivotButton=(v) Axlsx::validate_boolean v; @pivotButton = v end
23
- def applyNumberFormat=(v) Axlsx::validate_boolean v; @applyNumberFormat = v end
24
- def applyFont=(v) Axlsx::validate_boolean v; @applyFont = v end
25
- def applyFill=(v) Axlsx::validate_boolean v; @applyFill = v end
26
- def applyBorder=(v) Axlsx::validate_boolean v; @applyBorder = v end
27
- def applyAlignment=(v) Axlsx::validate_boolean v; @applyAlignment = v end
28
- def applyProtection=(v) Axlsx::validate_boolean v; @applyProtection = v end
29
-
30
- def to_xml(xml)
31
- xml.xf(self.instance_values.reject { |k, v| [:alignment, :protection, :extList, :name].include? k.to_sym}) {
32
- alignment.to_xml(xml) if self.alignment
33
- protection.to_xml(xml) if self.protection
34
- }
35
- end
36
- end
37
- end
@@ -1,187 +0,0 @@
1
- module Axlsx
2
-
3
- # version
4
- VERSION="1.0.1.a"
5
-
6
- # XML Encoding
7
- ENCODING = "UTF-8"
8
-
9
- # spreadsheetML namespace
10
- XML_NS = "http://schemas.openxmlformats.org/spreadsheetml/2006/main"
11
-
12
- # content-types namespace
13
- XML_NS_T = "http://schemas.openxmlformats.org/package/2006/content-types"
14
-
15
- # extended-properties namespace
16
- APP_NS = "http://schemas.openxmlformats.org/officeDocument/2006/extended-properties"
17
-
18
- # doc props namespace
19
- APP_NS_VT = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"
20
-
21
- # core properties namespace
22
- CORE_NS = "http://schemas.openxmlformats.org/package/2006/metadata/core-properties"
23
-
24
- # dc elements (core) namespace
25
- CORE_NS_DC = "http://purl.org/dc/elements/1.1/"
26
-
27
- # dcmit (core) namespcace
28
- CORE_NS_DCMIT = "http://purl.org/dc/dcmitype/"
29
-
30
- # dc terms namespace
31
- CORE_NS_DCT = "http://purl.org/dc/terms/"
32
-
33
- # xml schema namespace
34
- CORE_NS_XSI = "http://www.w3.org/2001/XMLSchema-instance"
35
-
36
- # spreadsheet drawing namespace
37
- XML_NS_XDR = "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"
38
-
39
- # drawing namespace
40
- XML_NS_A = "http://schemas.openxmlformats.org/drawingml/2006/main"
41
-
42
- # chart namespace
43
- XML_NS_C = "http://schemas.openxmlformats.org/drawingml/2006/chart"
44
-
45
- # relationships namespace
46
- XML_NS_R = "http://schemas.openxmlformats.org/officeDocument/2006/relationships"
47
-
48
-
49
- # relationships name space
50
- RELS_R = "http://schemas.openxmlformats.org/package/2006/relationships"
51
-
52
- # table rels namespace
53
- TABLE_R = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/table"
54
-
55
- # workbook rels namespace
56
- WORKBOOK_R = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"
57
-
58
- # worksheet rels namespace
59
- WORKSHEET_R = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet"
60
-
61
- # app rels namespace
62
- APP_R = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties"
63
-
64
- # core rels namespace
65
- CORE_R = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/metadata/core-properties"
66
-
67
- # styles rels namespace
68
- STYLES_R = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"
69
-
70
- # drawing rels namespace
71
- DRAWING_R = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing"
72
-
73
- # chart rels namespace
74
- CHART_R = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart"
75
-
76
- # table content type
77
- TABLE_CT = "application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml"
78
-
79
- # workbook content type
80
- WORKBOOK_CT = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"
81
-
82
- # app content type
83
- APP_CT = "application/vnd.openxmlformats-officedocument.extended-properties+xml"
84
-
85
- # rels content type
86
- RELS_CT = "application/vnd.openxmlformats-package.relationships+xml"
87
-
88
- # styles content type
89
- STYLES_CT = "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"
90
-
91
- # xml content type
92
- XML_CT = "application/xml"
93
-
94
- # worksheet content type
95
- WORKSHEET_CT = "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"
96
-
97
- # shared strings content type
98
- SHARED_STRINGS_CT = "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml"
99
-
100
- # core content type
101
- CORE_CT = "application/vnd.openxmlformats-package.core-properties+xml"
102
-
103
- # chart content type
104
- CHART_CT = "application/vnd.openxmlformats-officedocument.drawingml.chart+xml"
105
-
106
- #drawing content type
107
- DRAWING_CT = "application/vnd.openxmlformats-officedocument.drawing+xml"
108
-
109
- # xml content type extensions
110
- XML_EX = "xml"
111
-
112
- # rels content type extension
113
- RELS_EX = "rels"
114
-
115
- # workbook part
116
- WORKBOOK_PN = "xl/workbook.xml"
117
-
118
- # styles part
119
- STYLES_PN = "styles.xml"
120
-
121
- # app part
122
- APP_PN = "docProps/app.xml"
123
-
124
- # core part
125
- CORE_PN = "docProps/core.xml"
126
-
127
- # content types part
128
- CONTENT_TYPES_PN = "[Content_Types].xml"
129
-
130
- # rels part
131
- RELS_PN = "_rels/.rels"
132
-
133
- # workbook rels part
134
- WORKBOOK_RELS_PN = "xl/_rels/workbook.xml.rels"
135
-
136
- # worksheet part
137
- WORKSHEET_PN = "worksheets/sheet%d.xml"
138
-
139
- # worksheet rels part
140
- WORKSHEET_RELS_PN = "worksheets/_rels/sheet%d.xml.rels"
141
-
142
- # drawing part
143
- DRAWING_PN = "drawings/drawing%d.xml"
144
-
145
- # drawing rels part
146
- DRAWING_RELS_PN = "drawings/_rels/drawing%d.xml.rels"
147
-
148
- # chart part
149
- CHART_PN = "charts/chart%d.xml"
150
-
151
- # App validation schema
152
- APP_XSD = "lib/schema/shared-documentPropertiesExtended.xsd"
153
-
154
- # core validation schema
155
- CORE_XSD = "lib/schema/opc-coreProperties.xsd"
156
-
157
- # content types validation schema
158
- CONTENT_TYPES_XSD = "lib/schema/opc-contentTypes.xsd"
159
-
160
- # rels validation schema
161
- RELS_XSD = "lib/schema/opc-relationships.xsd"
162
-
163
- # spreadsheetML validation schema
164
- SML_XSD = "lib/schema/sml.xsd"
165
-
166
- # drawing validation schema
167
- DRAWING_XSD = "lib/schema/dml-spreadsheetDrawing.xsd"
168
-
169
- # number format id for pecentage formatting using the default formatting id.
170
- NUM_FMT_PERCENT = 9
171
-
172
- # number format id for date format like 2011/11/13
173
- NUM_FMT_YYYYMMDD = 100
174
-
175
- # number format id for time format the creates 2011/11/13 12:23:10
176
- NUM_FMT_YYYYMMDDHHMMSS = 101
177
-
178
- # cellXfs id for thin borders around the cell
179
- STYLE_THIN_BORDER = 1
180
-
181
- # error messages RestrictionValidor
182
- ERR_RESTRICTION = "Invalid Data: %s. %s must be one of %s."
183
-
184
- # error message DataTypeValidator
185
- ERR_TYPE = "Invalid Data %s for %s. must be %s."
186
-
187
- end
@@ -1,61 +0,0 @@
1
- require 'zip/zip' #dep
2
-
3
- __END__
4
-
5
- module Zip
6
- class ZipOutputStream
7
- def initialize(fileName)
8
- super()
9
- if fileName.is_a?(String) && !fileName.empty?
10
- @fileName = fileName
11
- @outputStream = File.new(@fileName, "wb")
12
- else
13
- @outputStream = fileName
14
- @fileName = ''
15
- end
16
- @entrySet = ZipEntrySet.new
17
- @compressor = NullCompressor.instance
18
- @closed = false
19
- @currentEntry = nil
20
- @comment = nil
21
- end
22
- end
23
-
24
- class ZipFile < ZipCentralDirectory
25
- def initialize(stream, create = nil)
26
- super()
27
- @name = stream.is_a?(String) ? stream : ''
28
- @comment = ""
29
- if stream.is_a?(String) && File.exists?(stream)
30
- File.open(name, "rb") { |f| read_from_stream(f) }
31
- elsif (create)
32
- @entrySet = ZipEntrySet.new
33
- elsif !stream.is_a?(String) && !create && !stream.respond_to(:path)
34
- # do nothing here
35
- elsif !stream.is_a?(String) && !create
36
- File.open(stream.path, "rb") { |f| read_from_stream(f) }
37
- else
38
- raise ZipError, "File #{stream} not found"
39
- end
40
- @create = create
41
- @storedEntries = @entrySet.dup
42
-
43
- @restore_ownership = false
44
- @restore_permissions = false
45
- @restore_times = true
46
- end
47
-
48
- def on_success_replace arg
49
- if arg.is_a?(String) && !arg.empty?
50
- tmpfile = get_tempfile
51
- tmpFilename = tmpfile.path
52
- tmpfile.close
53
- if yield tmpFilename
54
- File.rename(tmpFilename, name)
55
- end
56
- else
57
- yield arg
58
- end
59
- end
60
- end
61
- end
@@ -1,79 +0,0 @@
1
- module Axlsx
2
- class SimpleTypedList
3
- attr_reader :allowed_types, :list, :locked_at, :serialize_as
4
-
5
- def initialize type, serialize_as=nil
6
- if type.is_a? Array
7
- type.each { |item| raise ArgumentError, "All members of type must be Class objects" unless item.is_a? Class }
8
- @allowed_types = type
9
- else
10
- raise ArgumentError, "Type must be a Class object or array of Class objects" unless type.is_a? Class
11
- @allowed_types = [type]
12
- end
13
- @list = []
14
- @locked_at = nil
15
- @serialize_as = serialize_as
16
- end
17
-
18
- def lock
19
- @locked_at = @list.size
20
- end
21
-
22
- def unlock
23
- @locked_at = nil
24
- end
25
-
26
- def <<(v)
27
- raise ArgumentError, "Only #{@allowed_types} objects allowed" unless @allowed_types.include? v.class
28
- @list << v
29
- @list.size - 1
30
- end
31
-
32
- def push(v)
33
- self.<< v
34
- end
35
-
36
- def delete(v)
37
- return unless @list.include? v
38
- raise ArgumentError, "Item is protected and cannot be deleted" if protected? @list.index(v)
39
- @list.delete v
40
- end
41
-
42
- def delete_at(index)
43
- @list[index]
44
- raise ArgumentError, "Item is protected and cannot be deleted" if protected? index
45
- @list.delete_at index
46
- end
47
-
48
- def []=(index, v)
49
- raise ArgumentError, "Only #{@allowed_types} objects allowed" unless @allowed_types.include? v.class
50
- raise ArgumentError, "Item is protected and cannot be changed" if protected? index
51
- @list[index] = v
52
- v
53
- end
54
-
55
- def protected? index
56
- return false unless @locked_at.is_a? Fixnum
57
- index < @locked_at
58
- end
59
-
60
- def method_missing(meth, *args, &block)
61
- raise ArgumentError, "#{meth} not supported" if [:replace, :insert, :collect!, :map!, :pop, :push, :delete_if, :reverse!, :shift, :shuffle!, :slice!, :sort!, :uniq!, :unshift, :zip, :flatten!, :fill, :drop, :drop_while, :delete_if, :clear, :concat].include? meth.to_sym
62
- if @list.respond_to? meth
63
- @list.send(meth, *args, &block)
64
- else
65
- super
66
- end
67
- end
68
-
69
- def to_xml(xml)
70
-
71
- classname = @allowed_types[0].name.split('::').last
72
- el_name = serialize_as || (classname[0,1].downcase + classname[1..-1]).pluralize
73
- xml.send(el_name, :count=>@list.size) {
74
- @list.each { |item| item.to_xml(xml) }
75
- }
76
- end
77
- end
78
-
79
- end