axlsx 1.0.18 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +11 -3
- data/README.md +93 -18
- data/examples/example.csv +1000 -0
- data/examples/example.rb +97 -5
- data/examples/example.xlsx +0 -0
- data/examples/example_streamed.xlsx +0 -0
- data/examples/no-use_autowidth.xlsx +0 -0
- data/examples/shared_strings_example.xlsx +0 -0
- data/lib/axlsx.rb +30 -9
- data/lib/axlsx/content_type/content_type.rb +9 -9
- data/lib/axlsx/content_type/default.rb +9 -6
- data/lib/axlsx/content_type/override.rb +12 -8
- data/lib/axlsx/doc_props/app.rb +37 -40
- data/lib/axlsx/doc_props/core.rb +12 -17
- data/lib/axlsx/drawing/axis.rb +38 -19
- data/lib/axlsx/drawing/bar_3D_chart.rb +33 -32
- data/lib/axlsx/drawing/bar_series.rb +13 -14
- data/lib/axlsx/drawing/cat_axis.rb +15 -14
- data/lib/axlsx/drawing/cat_axis_data.rb +16 -18
- data/lib/axlsx/drawing/chart.rb +37 -38
- data/lib/axlsx/drawing/drawing.rb +15 -12
- data/lib/axlsx/drawing/graphic_frame.rb +21 -21
- data/lib/axlsx/drawing/hyperlink.rb +12 -11
- data/lib/axlsx/drawing/line_3D_chart.rb +30 -28
- data/lib/axlsx/drawing/line_series.rb +11 -11
- data/lib/axlsx/drawing/marker.rb +10 -8
- data/lib/axlsx/drawing/named_axis_data.rb +36 -0
- data/lib/axlsx/drawing/one_cell_anchor.rb +17 -16
- data/lib/axlsx/drawing/pic.rb +24 -37
- data/lib/axlsx/drawing/picture_locking.rb +21 -18
- data/lib/axlsx/drawing/pie_3D_chart.rb +10 -8
- data/lib/axlsx/drawing/pie_series.rb +15 -12
- data/lib/axlsx/drawing/scaling.rb +10 -10
- data/lib/axlsx/drawing/scatter_chart.rb +69 -0
- data/lib/axlsx/drawing/scatter_series.rb +39 -0
- data/lib/axlsx/drawing/ser_axis.rb +10 -10
- data/lib/axlsx/drawing/series.rb +15 -15
- data/lib/axlsx/drawing/series_title.rb +14 -14
- data/lib/axlsx/drawing/title.rb +26 -26
- data/lib/axlsx/drawing/two_cell_anchor.rb +18 -20
- data/lib/axlsx/drawing/val_axis.rb +8 -7
- data/lib/axlsx/drawing/val_axis_data.rb +17 -17
- data/lib/axlsx/drawing/view_3D.rb +22 -20
- data/lib/axlsx/package.rb +32 -15
- data/lib/axlsx/rels/relationship.rb +9 -6
- data/lib/axlsx/rels/relationships.rb +7 -1
- data/lib/axlsx/stylesheet/#num_fmt.rb# +69 -0
- data/lib/axlsx/stylesheet/border.rb +27 -23
- data/lib/axlsx/stylesheet/border_pr.rb +16 -15
- data/lib/axlsx/stylesheet/cell_alignment.rb +23 -21
- data/lib/axlsx/stylesheet/cell_protection.rb +10 -7
- data/lib/axlsx/stylesheet/cell_style.rb +8 -5
- data/lib/axlsx/stylesheet/color.rb +20 -14
- data/lib/axlsx/stylesheet/fill.rb +7 -5
- data/lib/axlsx/stylesheet/font.rb +14 -14
- data/lib/axlsx/stylesheet/gradient_fill.rb +19 -16
- data/lib/axlsx/stylesheet/gradient_stop.rb +9 -5
- data/lib/axlsx/stylesheet/num_fmt.rb +12 -6
- data/lib/axlsx/stylesheet/pattern_fill.rb +25 -10
- data/lib/axlsx/stylesheet/styles.rb +41 -32
- data/lib/axlsx/stylesheet/table_style.rb +9 -4
- data/lib/axlsx/stylesheet/table_style_element.rb +10 -7
- data/lib/axlsx/stylesheet/table_styles.rb +11 -8
- data/lib/axlsx/stylesheet/xf.rb +29 -25
- data/lib/axlsx/util/constants.rb +4 -0
- data/lib/axlsx/util/simple_typed_list.rb +18 -9
- data/lib/axlsx/util/validators.rb +13 -6
- data/lib/axlsx/version.rb +1 -1
- data/lib/axlsx/workbook/shared_strings_table.rb +19 -21
- data/lib/axlsx/workbook/workbook.rb +43 -19
- data/lib/axlsx/workbook/worksheet/cell.rb +93 -91
- data/lib/axlsx/workbook/worksheet/col.rb +114 -0
- data/lib/axlsx/workbook/worksheet/col.rb~ +0 -0
- data/lib/axlsx/workbook/worksheet/page_margins.rb +16 -13
- data/lib/axlsx/workbook/worksheet/row.rb +13 -13
- data/lib/axlsx/workbook/worksheet/table.rb +96 -0
- data/lib/axlsx/workbook/worksheet/table.rb~ +97 -0
- data/lib/axlsx/workbook/worksheet/worksheet.rb +152 -118
- data/lib/schema/dc.xsd +5 -5
- data/lib/schema/dcmitype.xsd +5 -3
- data/lib/schema/dcterms.xsd +15 -15
- data/lib/schema/opc-coreProperties.xsd +6 -2
- data/lib/schema/xml.xsd +7 -8
- data/test/#benchmark.txt# +7 -0
- data/test/#tc_helper.rb# +3 -0
- data/test/benchmark.rb +81 -0
- data/test/benchmark.rb~ +0 -0
- data/test/benchmark.txt +6 -0
- data/test/benchmark.txt~ +6 -0
- data/test/content_type/tc_content_type.rb +30 -32
- data/test/content_type/tc_default.rb +8 -23
- data/test/content_type/tc_override.rb +7 -21
- data/test/doc_props/tc_app.rb +2 -8
- data/test/doc_props/tc_core.rb +6 -7
- data/test/drawing/tc_axis.rb +7 -3
- data/test/drawing/tc_bar_3D_chart.rb +6 -7
- data/test/drawing/tc_bar_series.rb +4 -5
- data/test/drawing/tc_cat_axis.rb +2 -3
- data/test/drawing/tc_cat_axis_data.rb +2 -3
- data/test/drawing/tc_chart.rb +11 -12
- data/test/drawing/tc_drawing.rb +7 -8
- data/test/drawing/tc_graphic_frame.rb +3 -4
- data/test/drawing/tc_hyperlink.rb +2 -3
- data/test/drawing/tc_line_3d_chart.rb +5 -6
- data/test/drawing/tc_line_series.rb +3 -4
- data/test/drawing/tc_marker.rb +3 -4
- data/test/drawing/tc_one_cell_anchor.rb +6 -7
- data/test/drawing/tc_pic.rb +8 -9
- data/test/drawing/tc_picture_locking.rb +2 -3
- data/test/drawing/tc_pie_3D_chart.rb +5 -6
- data/test/drawing/tc_pie_series.rb +4 -5
- data/test/drawing/tc_scaling.rb +3 -4
- data/test/drawing/tc_scatter_chart.rb +43 -0
- data/test/drawing/tc_scatter_series.rb +20 -0
- data/test/drawing/tc_ser_axis.rb +2 -3
- data/test/drawing/tc_series.rb +4 -5
- data/test/drawing/tc_series_title.rb +4 -5
- data/test/drawing/tc_title.rb +4 -5
- data/test/drawing/tc_two_cell_anchor.rb +4 -5
- data/test/drawing/tc_val_axis.rb +2 -3
- data/test/drawing/tc_val_axis_data.rb +2 -3
- data/test/drawing/tc_view_3D.rb +6 -7
- data/test/example.csv +1000 -0
- data/test/example.xlsx +0 -0
- data/test/example_streamed.xlsx +0 -0
- data/test/profile.rb +33 -0
- data/test/rels/tc_relationship.rb +5 -6
- data/test/rels/tc_relationships.rb +4 -5
- data/test/stylesheet/tc_border.rb +3 -4
- data/test/stylesheet/tc_border_pr.rb +3 -4
- data/test/stylesheet/tc_cell_alignment.rb +4 -5
- data/test/stylesheet/tc_cell_protection.rb +2 -3
- data/test/stylesheet/tc_cell_style.rb +2 -3
- data/test/stylesheet/tc_color.rb +2 -3
- data/test/stylesheet/tc_fill.rb +1 -2
- data/test/stylesheet/tc_font.rb +5 -6
- data/test/stylesheet/tc_gradient_fill.rb +1 -2
- data/test/stylesheet/tc_gradient_stop.rb +1 -2
- data/test/stylesheet/tc_num_fmt.rb +1 -2
- data/test/stylesheet/tc_pattern_fill.rb +3 -4
- data/test/stylesheet/tc_styles.rb +15 -9
- data/test/stylesheet/tc_table_style.rb +2 -3
- data/test/stylesheet/tc_table_style_element.rb +2 -3
- data/test/stylesheet/tc_table_styles.rb +3 -4
- data/test/stylesheet/tc_xf.rb +16 -17
- data/test/tc_axlsx.rb +39 -0
- data/test/tc_axlsx.rb~ +0 -0
- data/test/tc_helper.rb +3 -0
- data/test/tc_helper.rb~ +3 -0
- data/test/tc_package.rb +13 -10
- data/test/util/tc_simple_typed_list.rb +8 -9
- data/test/util/tc_validators.rb +7 -8
- data/test/workbook/tc_shared_strings_table.rb +5 -6
- data/test/workbook/tc_workbook.rb +24 -6
- data/test/workbook/worksheet/table/tc_table.rb +71 -0
- data/test/workbook/worksheet/table/tc_table.rb~ +72 -0
- data/test/workbook/worksheet/tc_cell.rb +24 -10
- data/test/workbook/worksheet/tc_col.rb +59 -0
- data/test/workbook/worksheet/tc_col.rb~ +10 -0
- data/test/workbook/worksheet/tc_date_time_converter.rb +1 -2
- data/test/workbook/worksheet/tc_page_margins.rb +6 -9
- data/test/workbook/worksheet/tc_row.rb +26 -12
- data/test/workbook/worksheet/tc_worksheet.rb +134 -68
- metadata +150 -90
- data/test/drawing/tc_hyperlink.rb~ +0 -71
- data/test/workbook/tc_shared_strings_table.rb~ +0 -8
- data/test/workbook/worksheet/tc_date_time_converter.rb~ +0 -69
@@ -1,69 +0,0 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
require 'axlsx.rb'
|
3
|
-
|
4
|
-
class TestConverter < Test::Unit::TestCase
|
5
|
-
def setup
|
6
|
-
@converter = Axlsx::Converter.new
|
7
|
-
@margin_of_error = 0.000_001
|
8
|
-
end
|
9
|
-
|
10
|
-
def test_date_to_serial_1900
|
11
|
-
{ # examples taken straight from the spec
|
12
|
-
"1893-08-05" => -2338.0,
|
13
|
-
"1900-01-01" => 2.0,
|
14
|
-
"1910-02-03" => 3687.0,
|
15
|
-
"2006-02-01" => 38749.0,
|
16
|
-
"9999-12-31" => 2958465.0,
|
17
|
-
}.each do |date_string, expected|
|
18
|
-
serial = @converter.date_to_serial Date.parse(date_string)
|
19
|
-
assert_equal serial, expected
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def test_date_to_serial_1904
|
24
|
-
{ # examples taken straight from the spec
|
25
|
-
"1893-08-05" => -3800.0,
|
26
|
-
"1904-01-01" => 0.0,
|
27
|
-
"1910-02-03" => 2225.0,
|
28
|
-
"2006-02-01" => 37287.0,
|
29
|
-
"9999-12-31" => 2957003.0,
|
30
|
-
}.each do |date_string, expected|
|
31
|
-
serial = @converter.date_to_serial Date.parse(date_string), true
|
32
|
-
assert_equal serial, expected
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_time_to_serial_1900
|
37
|
-
{ # examples taken straight from the spec
|
38
|
-
"1893-08-05T00:00:01Z" => -2337.999989,
|
39
|
-
"1899-12-28T18:00:00Z" => -1.25,
|
40
|
-
"1910-02-03T10:05:54Z" => 3687.4207639,
|
41
|
-
"1900-01-01T12:00:00Z" => 2.5, # wrongly indicated as 1.5 in the spec!
|
42
|
-
"9999-12-31T23:59:59Z" => 2958465.9999884,
|
43
|
-
}.each do |time_string, expected|
|
44
|
-
serial = @converter.time_to_serial Time.parse(time_string)
|
45
|
-
assert_in_delta serial, expected, @margin_of_error
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
def test_time_to_serial_1904
|
50
|
-
{ # examples taken straight from the spec
|
51
|
-
"1893-08-05T00:00:01Z" => -3799.999989,
|
52
|
-
"1910-02-03T10:05:54Z" => 2225.4207639,
|
53
|
-
"1904-01-01T12:00:00Z" => 0.5000000,
|
54
|
-
"9999-12-31T23:59:59Z" => 2957003.9999884,
|
55
|
-
}.each do |time_string, expected|
|
56
|
-
serial = @converter.time_to_serial Time.parse(time_string), true
|
57
|
-
assert_in_delta serial, expected, @margin_of_error
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
def test_timezone
|
62
|
-
utc = Time.utc 2012 # January 1st, 2012 at 0:00 UTC
|
63
|
-
local = Time.new 2012, 1, 1, 1, 0, 0, 3600 # January 1st, 2012 at 1:00 GMT+1
|
64
|
-
assert_equal local, utc
|
65
|
-
assert_equal @converter.time_to_serial(local), @converter.time_to_serial(utc)
|
66
|
-
assert_equal @converter.time_to_serial(local, true), @converter.time_to_serial(utc, true)
|
67
|
-
end
|
68
|
-
|
69
|
-
end
|