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,87 +0,0 @@
1
- require 'rubygems'
2
- require 'axlsx'
3
-
4
- #A Simple Workbook
5
- p = Axlsx::Package.new
6
- p.workbook.add_worksheet do |sheet|
7
- sheet.add_row ["First", "Second", "Third"]
8
- sheet.add_row [1, 2, 3]
9
- end
10
- p.serialize("example1.xlsx")
11
-
12
- #Generating A Bar Chart
13
- p = Axlsx::Package.new
14
- p.workbook.add_worksheet do |sheet|
15
- sheet.add_row ["First", "Second", "Third"]
16
- sheet.add_row [1, 2, 3]
17
- sheet.add_chart(Axlsx::Bar3DChart, :start_at => [0,2], :end_at => [5, 15], :title=>"example 2: Chart") do |chart|
18
- chart.add_series :data=>sheet.rows.last.cells, :labels=> sheet.rows.first.cells
19
- end
20
- end
21
- p.serialize("example2.xlsx")
22
-
23
- #Generating A Pie Chart
24
- p = Axlsx::Package.new
25
- p.workbook.add_worksheet do |sheet|
26
- sheet.add_row ["First", "Second", "Third"]
27
- sheet.add_row [1, 2, 3]
28
- sheet.add_chart(Axlsx::Pie3DChart, :start_at => [0,2], :end_at => [5, 15], :title=>"example 3: Pie Chart") do |chart|
29
- chart.add_series :data=>sheet.rows.last.cells, :labels=> sheet.rows.first.cells
30
- end
31
- end
32
- p.serialize("example3.xlsx")
33
-
34
-
35
- #Using Custom Styles
36
-
37
- p = Axlsx::Package.new
38
- wb = p.workbook
39
- black_cell = wb.styles.add_style :bg_color => "FF000000", :fg_color => "FFFFFFFF", :sz=>14, :alignment => { :horizontal=> :center }
40
- blue_cell = wb.styles.add_style :bg_color => "FF0000FF", :fg_color => "FFFFFFFF", :sz=>14, :alignment => { :horizontal=> :center }
41
- wb.add_worksheet do |sheet|
42
- sheet.add_row ["Text Autowidth", "Second", "Third"], :style => [black_cell, blue_cell, black_cell]
43
- sheet.add_row [1, 2, 3], :style => Axlsx::STYLE_THIN_BORDER
44
- end
45
- p.serialize("example4.xlsx")
46
-
47
- #Using Custom Formatting and date1904
48
-
49
- p = Axlsx::Package.new
50
- wb = p.workbook
51
- date = wb.styles.add_style :format_code=>"yyyy-mm-dd", :border => Axlsx::STYLE_THIN_BORDER
52
- padded = wb.styles.add_style :format_code=>"00#", :border => Axlsx::STYLE_THIN_BORDER
53
- percent = wb.styles.add_style :format_code=>"0%", :border => Axlsx::STYLE_THIN_BORDER
54
- wb.date1904 = true # required for generation on mac
55
- wb.add_worksheet do |sheet|
56
- sheet.add_row ["Custom Formatted Date", "Percent Formatted Float", "Padded Numbers"], :style => Axlsx::STYLE_THIN_BORDER
57
- sheet.add_row [Time.now, 0.2, 32], :style => [date, percent, padded]
58
- end
59
- p.serialize("example5.xlsx")
60
-
61
- #Validation
62
-
63
- p = Axlsx::Package.new
64
- p.workbook.add_worksheet do |sheet|
65
- sheet.add_row ["First", "Second", "Third"]
66
- sheet.add_row [1, 2, 3]
67
- end
68
-
69
- p.validate.each do |error|
70
- puts error.inspect
71
- end
72
-
73
- #Generating A Line Chart
74
-
75
- p = Axlsx::Package.new
76
- p.workbook.add_worksheet do |sheet|
77
- sheet.add_row ["First", 1, 5, 7, 9]
78
- sheet.add_row ["Second", 5, 2, 14, 9]
79
- sheet.add_chart(Axlsx::Line3DChart, :title=>"example 6: Line Chart") do |chart|
80
- chart.start_at 0, 2
81
- chart.end_at 10, 15
82
- chart.add_series :data=>sheet.rows.first.cells[(1..-1)], :title=> sheet.rows.first.cells.first
83
- chart.add_series :data=>sheet.rows.last.cells[(1..-1)], :title=> sheet.rows.last.cells.first
84
- end
85
-
86
- end
87
- p.serialize("example6.xlsx")
@@ -1,79 +0,0 @@
1
- require 'rubygems'
2
- require 'axlsx'
3
-
4
- wb =Axlsx::Workbook.new(:date1904=>true)
5
- p = Axlsx::Package.new(:workbook=>wb)
6
-
7
- styles = wb.styles
8
-
9
- header_style = styles.add_style(:bg_color=>"FF000000", :fg_color=>"FFFFFFFF", :sz=>14, :alignment=>{:horizontal=>:center})
10
- table_title = styles.add_style :sz=>22
11
- date_time = styles.add_style(:num_fmt=>Axlsx::NUM_FMT_YYYYMMDDHHMMSS)
12
- date = styles.add_style :num_fmt=>Axlsx::NUM_FMT_YYYYMMDD
13
- bordered = styles.add_style :border=>Axlsx::STYLE_THIN_BORDER
14
-
15
- wb.add_worksheet do |sheet|
16
- sheet.name = "Example 1"
17
- # add cells as a row
18
- sheet.add_row :values=>['Example 1 Styling and Bar Chart'], :style=>table_title
19
- sheet.add_row :values=>["Formatted Time Stamp", Time.now],:style=>[nil, date_time]
20
- # adding cells one at a time
21
- sheet.add_row do |row|
22
- row.add_cell "Formatted Date"
23
- row.add_cell Time.now, :style => date, :type=>:time
24
- end
25
-
26
- # Bar 3D Chart
27
- sheet.add_row
28
- label_row = sheet.add_row :values=>["0 ~ 10", "11 ~ 20", "21 ~ 60"], :style=>header_style
29
- data_row = sheet.add_row :values=>[12, 60, 25], :style=>bordered
30
- sheet.add_chart(Axlsx::Bar3DChart, :show_legend=>false) do |chart|
31
- chart.title = Axlsx::Title.new(sheet.rows.first.cells.first)
32
- chart.add_series :data => data_row.cells, :labels => label_row.cells
33
- chart.start_at.coord(0, 7)
34
- chart.end_at.coord(3, 17)
35
- end
36
-
37
- end
38
-
39
- # Blocks are not required
40
- percent = styles.add_style :num_fmt=>Axlsx::NUM_FMT_PERCENT, :border=>Axlsx::STYLE_THIN_BORDER
41
- wb.add_worksheet(:name=>"Example 2") do |sheet|
42
- sheet.add_row :values=>["Example 2 - Styling and Pie Chart"], :style=>table_title
43
- label_row = sheet.add_row(:values=>["Summer", "Fall", "Winter", "Spring"], :style=>header_style)
44
- data_row = sheet.add_row :values=>[0.5, 0.2, 0.2, 0.1], :style=>percent
45
- chart = sheet.add_chart(Axlsx::Pie3DChart, :start_at => [0,4], :end_at => [4,14], :title => "Pie Consumption per Season") do |chart|
46
- chart.add_series :data => data_row.cells, :labels=>label_row.cells
47
- end
48
- end
49
- # Charts can be build with out data in the sheet
50
- wb.add_worksheet(:name=>"Example 3") do |ws|
51
- ws.add_row :values=>["Charts can be build without any data in the worksheet"]
52
- ws.add_chart(Axlsx::Pie3DChart, :title=>"free chart 1") do |chart|
53
- chart.start_at.coord(0,2)
54
- chart.end_at.coord(3,12)
55
- chart.add_series :data => [13,54,1], :labels=>["nothing","in","the sheet"]
56
- end
57
- ws.add_chart(Axlsx::Pie3DChart) do |chart|
58
- chart.start_at.coord(0,13)
59
- chart.end_at.coord(3,23)
60
- chart.add_series :data => [1,4,5], :labels=>["nothing","in","the sheet"], :title=>"free chart 2"
61
- end
62
- end
63
-
64
- # wb.add_worksheet(:name=>"Example 4") do |sheet|
65
- # sheet.add_row :values=>["lots of data!"]
66
- # (1..100).each do |i|
67
- # cells = (1..50).map { |i| rand(5 ** 10) }
68
- # sheet.add_row :values=>cells
69
- # end
70
- # end
71
-
72
- errors = p.validate
73
- if errors.empty?
74
- f = File.open('test.xlsx', 'w')
75
- p.serialize(f)
76
- else
77
- puts errors.to_s
78
- end
79
-
Binary file
@@ -1,67 +0,0 @@
1
-
2
- require 'axlsx/util/simple_typed_list.rb'
3
- require 'axlsx/util/constants.rb'
4
- require 'axlsx/util/validators.rb'
5
-
6
- require 'axlsx/stylesheet/border.rb'
7
- require 'axlsx/stylesheet/border_pr.rb'
8
- require 'axlsx/stylesheet/cell_alignment.rb'
9
- require 'axlsx/stylesheet/cell_style.rb'
10
- require 'axlsx/stylesheet/color.rb'
11
- require 'axlsx/stylesheet/fill.rb'
12
- require 'axlsx/stylesheet/font.rb'
13
- require 'axlsx/stylesheet/gradient_fill.rb'
14
- require 'axlsx/stylesheet/gradient_stop.rb'
15
- require 'axlsx/stylesheet/num_fmt.rb'
16
- require 'axlsx/stylesheet/pattern_fill.rb'
17
- require 'axlsx/stylesheet/styles.rb'
18
- require 'axlsx/stylesheet/table_style.rb'
19
- require 'axlsx/stylesheet/table_styles.rb'
20
- require 'axlsx/stylesheet/table_style_element.rb'
21
- require 'axlsx/stylesheet/xf.rb'
22
- require 'axlsx/stylesheet/cell_protection.rb'
23
-
24
- require 'axlsx/doc_props/app.rb'
25
- require 'axlsx/doc_props/core.rb'
26
-
27
- require 'axlsx/drawing/drawing.rb'
28
- require 'axlsx/drawing/graphic_frame.rb'
29
- require 'axlsx/drawing/marker.rb'
30
- require 'axlsx/drawing/pie_3D_chart.rb'
31
- require 'axlsx/drawing/series.rb'
32
- require 'axlsx/drawing/two_cell_anchor.rb'
33
- require 'axlsx/drawing/title.rb'
34
-
35
- require 'axlsx/content_type/content_type.rb'
36
- require 'axlsx/content_type/default.rb'
37
- require 'axlsx/content_type/override.rb'
38
-
39
-
40
- require 'axlsx/rels/relationship.rb'
41
- require 'axlsx/rels/relationships.rb'
42
-
43
- require 'axlsx/workbook/worksheet/row.rb'
44
- require 'axlsx/workbook/worksheet/cell.rb'
45
- require 'axlsx/workbook/workbook.rb'
46
- require 'axlsx/workbook/worksheet/worksheet.rb'
47
-
48
- require 'axlsx/package.rb'
49
-
50
-
51
- module Axlsx
52
-
53
- #required gems
54
- require 'Nokogiri'
55
- require 'active_support/core_ext/object/instance_variables'
56
- require 'active_support/inflector'
57
- require 'rmagick'
58
- require 'zip/zip'
59
-
60
- #core dependencies
61
- require 'bigdecimal'
62
- require 'time'
63
- require 'CGI'
64
-
65
-
66
-
67
- end
@@ -1,20 +0,0 @@
1
- module Axlsx
2
- # ContentTypes used in the package. This is automatcially managed by the package package.
3
- class ContentType < SimpleTypedList
4
-
5
- def initialize
6
- super [Override, Default]
7
- end
8
-
9
- # Generates the xml document for [Content_Types].xml
10
- # @return [String] The document as a string.
11
- def to_xml()
12
- builder = Nokogiri::XML::Builder.new(:encoding => ENCODING) do |xml|
13
- xml.Types(:xmlns => Axlsx::XML_NS_T) {
14
- each { |type| type.to_xml(xml) }
15
- }
16
- end
17
- builder.to_xml
18
- end
19
- end
20
- end
@@ -1,32 +0,0 @@
1
- module Axlsx
2
- # An default content part. These parts are automatically created by for you based on the content of your package.
3
- class Default
4
-
5
- # The extension of the content type.
6
- # @return [String]
7
- attr_accessor :Extension
8
-
9
- # @return [String] ContentType The type of content. TABLE_CT, WORKBOOK_CT, APP_CT, RELS_CT, STYLES_CT, XML_CT, WORKSHEET_CT, SHARED_STRINGS_CT, CORE_CT, CHART_CT, DRAWING_CT are allowed
10
- attr_accessor :ContentType
11
-
12
- #Creates a new Default object
13
- # @option options [String] Extension
14
- # @option options [String] ContentType
15
- # @raise [ArgumentError] An argument error is raised if both Extension and ContentType are not specified.
16
- def initialize(options={})
17
- raise ArugumentError, "Extension and ContentType are required" unless options[:Extension] && options[:ContentType]
18
- options.each do |o|
19
- self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
20
- end
21
- end
22
- def Extension=(v) Axlsx::validate_string v; @Extension = v end
23
- def ContentType=(v) Axlsx::validate_content_type v; @ContentType = v end
24
-
25
- # Serializes the object to xml
26
- # @param [Nokogiri::XML::Builder] xml The document builder instance this objects xml will be added to.
27
- # @return [String]
28
- def to_xml(xml)
29
- xml.Default(self.instance_values)
30
- end
31
- end
32
- end
@@ -1,30 +0,0 @@
1
- module Axlsx
2
- # An override content part. These parts are automatically created by for you based on the content of your package.
3
- class Override
4
-
5
- # @return [String] ContentType The type of content. TABLE_CT, WORKBOOK_CT, APP_CT, RELS_CT, STYLES_CT, XML_CT, WORKSHEET_CT, SHARED_STRINGS_CT, CORE_CT, CHART_CT, DRAWING_CT are allowed
6
- attr_accessor :ContentType
7
-
8
- # @return [String] PartName The name and location of the part.
9
- attr_accessor :PartName
10
-
11
- #Creates a new Override object
12
- # @option options [String] PartName
13
- # @option options [String] ContentType
14
- # @raise [ArgumentError] An argument error is raised if both PartName and ContentType are not specified.
15
- def initialize(options={})
16
- raise ArugumentError, "PartName and ContentType are required" unless options[:PartName] && options[:ContentType]
17
- options.each do |o|
18
- self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
19
- end
20
- end
21
- def PartName=(v) Axlsx::validate_string v; @PartName = v end
22
- def ContentType=(v) Axlsx::validate_content_type v; @ContentType = v end
23
-
24
- # Serializes the Override object to xml
25
- # @param [Nokogiri::XML::Builder] xml The document builder instance this objects xml will be added to.
26
- def to_xml(xml)
27
- xml.Override(self.instance_values)
28
- end
29
- end
30
- end
@@ -1,127 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- module Axlsx
3
-
4
-
5
- # App represents the app.xml document. The attributes for this object are primarily managed by the application the end user uses to edit the document. None of the attributes are required to serialize a valid xlsx object.
6
- # @see shared-documentPropertiesExtended.xsd
7
- # @note Support is not implemented for the following complex types:
8
- #
9
- # HeadingPairs (VectorVariant),
10
- # TitlesOfParts (VectorLpstr),
11
- # HLinks (VectorVariant),
12
- # DigSig (DigSigBlob)
13
- class App
14
-
15
- # @return [String] The name of the document template.
16
- attr_accessor :Template
17
-
18
- # @return [String] The name of the manager for the document.
19
- attr_accessor :Manager
20
-
21
- # @return [String] The name of the company generating the document.
22
- attr_accessor :Company
23
-
24
- # @return [Integer] The number of pages in the document.
25
- attr_accessor :Pages
26
-
27
- # @return [Integer] The number of words in the document.
28
- attr_accessor :Words
29
-
30
- # @return [Integer] The number of characters in the document.
31
- attr_accessor :Characters
32
-
33
- # @return [String] The intended format of the presentation.
34
- attr_accessor :PresentationFormat
35
-
36
- # @return [Integer] The number of lines in the document.
37
- attr_accessor :Lines
38
-
39
- # @return [Integer] The number of paragraphs in the document
40
- attr_accessor :Paragraphs
41
-
42
- # @return [Intger] The number of slides in the document.
43
- attr_accessor :Slides
44
-
45
- # @return [Integer] The number of slides that have notes.
46
- attr_accessor :Notes
47
-
48
- # @return [Integer] The total amount of time spent editing.
49
- attr_accessor :TotalTime
50
-
51
- # @return [Integer] The number of hidden slides.
52
- attr_accessor :HiddenSlides
53
-
54
- # @return [Integer] The total number multimedia clips
55
- attr_accessor :MMClips
56
-
57
- # @return [Boolean] The display mode for the document thumbnail.
58
- attr_accessor :ScaleCrop
59
-
60
- # @return [Boolean] The links in the document are up to date.
61
- attr_accessor :LinksUpToDate
62
-
63
- # @return [Integer] The number of characters in the document including spaces.
64
- attr_accessor :CharactersWithSpaces
65
-
66
- # @return [Boolean] Indicates if the document is shared.
67
- attr_accessor :ShareDoc
68
-
69
- # @return [String] The base for hyper links in the document.
70
- attr_accessor :HyperLinkBase
71
-
72
- # @return [Boolean] Indicates that the hyper links in the document have been changed.
73
- attr_accessor :HyperlinksChanged
74
-
75
- # @return [String] The name of the application
76
- attr_accessor :Application
77
-
78
- # @return [String] The version of the application.
79
- attr_accessor :AppVersion
80
-
81
- # @return [Integer] Document security
82
- attr_accessor :DocSecurity
83
-
84
- def initalize(options={})
85
- options.each do |o|
86
- self.send("#{o[0]}=", o[1]) if self.respond_to? o[0]
87
- end
88
- end
89
-
90
- def Template=(v) Axlsx::validate_string v; @Template = v; end
91
- def Manager=(v) Axlsx::validate_string v; @Manager = v; end
92
- def Company=(v) Axlsx::validate_string v; @Company = v; end
93
- def Pages=(v) Axlsx::validate_int v; @Pages = v; end
94
- def Words=(v) Axlsx::validate_int v; @Words = v; end
95
- def Characters=(v) Axlsx::validate_int v; @Characters = v; end
96
- def PresentationFormat=(v) Axlsx::validate_string v; @PresentationFormat = v; end
97
- def Lines=(v) Axlsx::validate_int v; @Lines = v; end
98
- def Paragraphs=(v) Axlsx::validate_int v; @Paragraphs = v; end
99
- def Slides=(v) Axlsx::validate_int v; @Slides = v; end
100
- def Notes=(v) Axlsx::validate_int v; @Notes = v; end
101
- def TotalTime=(v) Axlsx::validate_int v; @TotalTime = v; end
102
- def HiddenSlides=(v) Axlsx::validate_int v; @HiddenSlides = v; end
103
- def MMClips=(v) Axlsx::validate_int v; @MMClips = v; end
104
- def ScaleCrop=(v) Axlsx::validate_boolean v; @ScaleCrop = v; end
105
- def LinksUpToDate=(v) Axlsx::validate_boolean v; @LinksUpToDate = v; end
106
- def CharactersWithSpaces=(v) Axlsx::validate_int v; @CharactersWithSpaces = v; end
107
- def ShareDoc=(v) Axlsx::validate_boolean v; @ShareDoc = v; end
108
- def HyperLinkBase=(v) Axlsx::validate_string v; @HyperLinkBase = v; end
109
- def HyperlinksChanged=(v) Axlsx::validate_boolean v; @HyperlinksChanged = v; end
110
- def Application=(v) Axlsx::validate_string v; @Application = v; end
111
- def AppVersion=(v) Axlsx::validate_string v; @AppVersion = v; end
112
- def DocSecurity=(v) Axlsx::validate_int v; @DocSecurity = v; end
113
-
114
- # Generate an app.xml document
115
- # @return [String] The document as a string
116
- def to_xml()
117
- builder = Nokogiri::XML::Builder.new(:encoding => ENCODING) do |xml|
118
- xml.send(:Properties, :xmlns => APP_NS, :'xmlns:vt' => APP_NS_VT) {
119
- self.instance_values.each do |name, value|
120
- xml.send("ap:#{name}", value)
121
- end
122
- }
123
- end
124
- builder.to_xml
125
- end
126
- end
127
- end