axlsx 1.3.3 → 1.3.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +14 -0
- data/README.md +15 -15
- data/Rakefile +1 -1
- data/examples/example.rb +106 -35
- data/examples/wrap_text.rb +21 -0
- data/lib/axlsx/drawing/chart.rb +1 -1
- data/lib/axlsx/rels/relationship.rb +1 -1
- data/lib/axlsx/util/serialized_attributes.rb +32 -1
- data/lib/axlsx/util/validators.rb +1 -0
- data/lib/axlsx/version.rb +1 -1
- data/lib/axlsx/workbook/workbook.rb +1 -0
- data/lib/axlsx/workbook/worksheet/cell.rb +5 -2
- data/lib/axlsx/workbook/worksheet/cfvos.rb +0 -3
- data/lib/axlsx/workbook/worksheet/color_scale.rb +56 -16
- data/lib/axlsx/workbook/worksheet/data_bar.rb +42 -18
- data/lib/axlsx/workbook/worksheet/header_footer.rb +54 -0
- data/lib/axlsx/workbook/worksheet/worksheet.rb +29 -11
- data/lib/axlsx/workbook/worksheet/worksheet_hyperlink.rb +1 -1
- data/test/benchmark.rb +1 -2
- data/test/example.xlsx +0 -0
- data/test/profile.rb +4 -13
- data/test/rels/tc_relationship.rb +5 -0
- data/test/tc_helper.rb +5 -1
- data/test/workbook/worksheet/tc_color_scale.rb +31 -2
- data/test/workbook/worksheet/tc_data_bar.rb +7 -0
- data/test/workbook/worksheet/tc_header_footer.rb +151 -0
- data/test/workbook/worksheet/tc_worksheet.rb +31 -6
- data/test/workbook/worksheet/tc_worksheet_hyperlink.rb +1 -1
- metadata +11 -49
- data/examples/doc/_index.html +0 -88
- data/examples/doc/class_list.html +0 -53
- data/examples/doc/css/common.css +0 -1
- data/examples/doc/css/full_list.css +0 -57
- data/examples/doc/css/style.css +0 -328
- data/examples/doc/file_list.html +0 -52
- data/examples/doc/frames.html +0 -28
- data/examples/doc/index.html +0 -88
- data/examples/doc/js/app.js +0 -214
- data/examples/doc/js/full_list.js +0 -173
- data/examples/doc/js/jquery.js +0 -4
- data/examples/doc/method_list.html +0 -52
- data/examples/doc/top-level-namespace.html +0 -102
- data/examples/extractive.pdf +0 -0
- data/examples/finance.rb +0 -82
- data/examples/hyperlinks.rb +0 -23
- data/examples/image1.gif +0 -0
- data/examples/image1.jpg +0 -0
- data/examples/image1.png +0 -0
- data/examples/sample.png +0 -0
- data/examples/scraping_html.rb +0 -91
- data/examples/sheet_view.rb +0 -34
- data/examples/skydrive/axlsx.csv +0 -1
- data/examples/skydrive/axlsx.xlsx +0 -0
- data/examples/sprk2012/Screen Shot 2012-09-11 at 10.42.06 PM.png +0 -0
- data/examples/sprk2012/Screen Shot 2012-09-11 at 11.07.48 PM.png +0 -0
- data/examples/sprk2012/Screen Shot 2012-09-11 at 8.31.50 PM.png +0 -0
- data/examples/sprk2012/Screen Shot 2012-09-11 at 9.23.27 PM.png +0 -0
- data/examples/sprk2012/Screen Shot 2012-09-11 at 9.32.06 PM.png +0 -0
- data/examples/sprk2012/Screen Shot 2012-09-11 at 9.33.35 PM.png +0 -0
- data/examples/sprk2012/Screen Shot 2012-09-11 at 9.46.44 PM.png +0 -0
- data/examples/sprk2012/Screen Shot 2012-09-12 at 5.07.23 PM.png +0 -0
- data/examples/sprk2012/basics.rb +0 -11
- data/examples/sprk2012/basics.xlsx +0 -0
- data/examples/sprk2012/gravatar.jpeg +0 -0
- data/examples/sprk2012/hair_club.jpg +0 -0
- data/examples/sprk2012/images.rb +0 -9
- data/examples/sprk2012/images.xlsx +0 -0
- data/examples/sprk2012/line_chart.rb +0 -56
- data/examples/sprk2012/line_chart.xlsx +0 -0
- data/examples/sprk2012/sprk2012.key +0 -0
- data/examples/sprk2012/styles.rb +0 -20
- data/examples/sprk2012/styles.xlsx +0 -0
- data/examples/two_cell_anchor_image.rb +0 -11
Binary file
|
@@ -1,56 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby -w -s
|
2
|
-
# -*- coding: utf-8 -*-
|
3
|
-
|
4
|
-
$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../../lib"
|
5
|
-
require 'axlsx'
|
6
|
-
|
7
|
-
data = [ ['oil-bbl',9591.411671,8860.714604,8237.936509,7700.523067,7231.831842,6819.307902,6453.297235,6126.251755,5832.182748,5566.276532,5324.618706,5103.992757,4901.730597,4715.600022,4543.718862,4384.488699,4236.543136,4098.707009,3969.963937,3849.430276,3736.33405,3629.997786,3529.824424,3435.28568,3345.912388,3261.286414,3181.033882,3104.819438,3032.341401,2963.327615,2897.531915,2834.731083,2774.722219,2717.320479,2662.357097,2609.677666,2559.140642,2510.616021,2463.984182,2419.134871,2375.966292,2334.384311,2294.301748,2255.637735,2218.317165,2182.270173,2147.431696,2113.741056,2081.141602,2049.580377,2019.007821,1989.377502,1960.645871,1932.772042,1905.71759,1879.446367,1853.924338,1829.119424,1805.001366,1781.541597,1758.713122,1736.490414,1714.849315,1693.766943,1673.22161,1653.192744,1633.660817,1614.607284,1596.014514,1577.865741,1560.145009,1542.837121,1525.927597,1509.402632,1493.249056,1477.454298,1462.006352,1446.893746,1432.105512,1417.631159,1403.460647,1389.584361,1375.993094,1362.678018,1349.630672,1336.842938,1324.307026,1312.015455,1299.961043,1288.136885,1276.536347,1265.153047,1253.980847,1243.013838,1232.246332,1221.672852,1211.288119,1201.087047,1191.064732,1181.216443,1171.537618,1162.023853,1152.670896,1143.474642,1134.431125,1125.536513,1116.787101,1108.179309,1099.709672,1091.37484,1083.171571,1075.096725,1067.147265,1059.320247,1051.612821,1044.022223,1036.545778,1029.180889,1021.92504,1014.775789],
|
8
|
-
|
9
|
-
['gas-mcf', 940970.153,836556.732,748476.939,673307.64,608520.158,552204.935,502892.3,459432.263,420911.806,386596.658,355889.491,328299.357,303418.988,280907.679,260478.232,241886.857,224925.287,209414.552,195200.029,182147.455,170139.707,159074.174,148860.596,139419.282,130679.626,122578.864,115061.035,108076.1,101579.19,95529.972,89892.104,84632.762,79722.24,75133.597,70842.349,66826.213,63064.865,59539.742,56233.86,53131.662,50218.869,47482.365,44910.082,42490.907,40214.588,38071.662,36053.382,34151.656,32358.989,30668.434,29073.545,27568.334,26147.237,24805.079,23537.041,22338.633,21205.67,20134.246,19120.717,18161.677,17253.941,16394.533,15580.663,14809.724,14079.269,13387.006,12730.786,12108.59,11518.524,10958.809,10427.774,9923.847,9445.55,8991.492,8560.364,8150.934,7762.041,7392.59,7041.551,6707.951,6390.874,6089.452,5802.871,5530.358,5271.185,5024.664,4790.145,4567.013,4354.687,4152.618,3960.286,3777.198,3602.889,3436.919,3278.87,3128.347,2984.976,2848.401,2718.287,2594.316,2476.184,2363.606,2256.309,2154.037,2056.545,1963.599,1874.982,1790.482,1709.903,1633.054,1559.758,1489.844,1423.151,1359.525,1298.821,1240.899,1185.628,1132.883,1082.544,1034.499],
|
10
|
-
|
11
|
-
['water-bbl',940.97,836.557,748.477,673.308,608.52,552.205,502.892,459.432,420.912,386.597,355.889,328.299,303.419,280.908,260.478,241.887,224.925,209.415,195.2,182.147,170.14,159.074,148.861,139.419,130.68,122.579,115.061,108.076,101.579,95.53,89.892,84.633,79.722,75.134,70.842,66.826,63.065,59.54,56.234,53.132,50.219,47.482,44.91,42.491,40.215,38.072,36.053,34.152,32.359,30.668,29.074,27.568,26.147,24.805,23.537,22.339,21.206,20.134,19.121,18.162,17.254,16.395,15.581,14.81,14.079,13.387,12.731,12.109,11.519,10.959,10.428,9.924,9.446,8.991,8.56,8.151,7.762,7.393,7.042,6.708,6.391,6.089,5.803,5.53,5.271,5.025,4.79,4.567,4.355,4.153,3.96,3.777,3.603,3.437,3.279,3.128,2.985,2.848,2.718,2.594,2.476,2.364,2.256,2.154,2.057,1.964,1.875,1.79,1.71,1.633,1.56,1.49,1.423,1.36,1.299,1.241,1.186,1.133,1.083,1.034] ]
|
12
|
-
|
13
|
-
package = Axlsx::Package.new
|
14
|
-
package.workbook.add_worksheet(:name => 'volumes') do |ws|
|
15
|
-
|
16
|
-
# perspective, rotX and rotY flatten the 3D chart
|
17
|
-
# hPercent sets the chart height to 100%
|
18
|
-
chart_options = { :perspective => 0,
|
19
|
-
:hPercent => 100,
|
20
|
-
:rotX => 0,
|
21
|
-
:rotY => 0,
|
22
|
-
:start_at => "A4",
|
23
|
-
:end_at => 'M44',
|
24
|
-
:title => 'Monthly forcast for Type Curve Gas secondary - gross ngl' }
|
25
|
-
|
26
|
-
chart = ws.add_chart(Axlsx::Line3DChart, chart_options)
|
27
|
-
|
28
|
-
# Set up log based scaling and appropriate min/max values for Y axis
|
29
|
-
chart.valAxis.scaling.logBase = 10
|
30
|
-
chart.valAxis.scaling.min = 0.1
|
31
|
-
chart.valAxis.scaling.max = 10000000.0
|
32
|
-
|
33
|
-
# No poing in showing the series axis labels as the chart is flattened!
|
34
|
-
chart.serAxis.delete = true
|
35
|
-
|
36
|
-
# Knock the catAxis labels down to the forced min.
|
37
|
-
chart.catAxis.crosses = :min
|
38
|
-
|
39
|
-
# set up cat labels / markes to show every 12th item
|
40
|
-
chart.catAxis.tickLblSkip = 12
|
41
|
-
chart.catAxis.tickMarkSkip = 12
|
42
|
-
|
43
|
-
#rgb colors for our data series
|
44
|
-
colors = ['00FF00', 'FF0000', '0000FF']
|
45
|
-
|
46
|
-
data.each_with_index do |value, index|
|
47
|
-
ws.add_row value
|
48
|
-
chart.add_series :data => ws.rows.last.cells[(1..value.size-1)],
|
49
|
-
:labels => (0..value.size).map{ |i| i },
|
50
|
-
:title => ws.rows.last.cells.first,
|
51
|
-
:color => colors[index]
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
package.serialize 'line_chart.xlsx'
|
56
|
-
|
Binary file
|
Binary file
|
data/examples/sprk2012/styles.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../../lib"
|
2
|
-
|
3
|
-
require 'axlsx'
|
4
|
-
package = Axlsx::Package.new
|
5
|
-
package.workbook do |workbook|
|
6
|
-
workbook.styles do |s|
|
7
|
-
black_cell = s.add_style :bg_color => "00", :fg_color => "FF", :sz => 14, :alignment => { :horizontal=> :center }
|
8
|
-
blue_cell = s.add_style :bg_color => "0000FF", :fg_color => "FF", :sz => 20, :alignment => { :horizontal=> :center }
|
9
|
-
|
10
|
-
workbook.add_worksheet(:name => "Styles") do |sheet|
|
11
|
-
# Applies the black_cell style to the first and third cell, and the blue_cell style to the second.
|
12
|
-
sheet.add_row ["Text Autowidth", "Second", "Third"], :style => [black_cell, blue_cell, black_cell]
|
13
|
-
|
14
|
-
# Applies the thin border to all three cells
|
15
|
-
sheet.add_row [1, 2, 3], :style => Axlsx::STYLE_THIN_BORDER
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
package.serialize 'styles.xlsx'
|
20
|
-
|
Binary file
|
@@ -1,11 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby -w -s
|
2
|
-
# -*- coding: utf-8 -*-
|
3
|
-
$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../lib"
|
4
|
-
require 'axlsx'
|
5
|
-
|
6
|
-
p = Axlsx::Package.new
|
7
|
-
src = "#{File.dirname(__FILE__)}/image1.png"
|
8
|
-
p.workbook.add_worksheet(:name => 'double_anchor') do |ws|
|
9
|
-
ws.add_image(:image_src => src, :start_at => [0,0], :end_at => [2,4])
|
10
|
-
end
|
11
|
-
p.serialize('two_cell_anchor_image.xlsx')
|