write_xlsx 0.51.0 → 0.54.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +39 -0
- data/Gemfile +4 -14
- data/LICENSE.txt +3 -1
- data/README.rdoc +5 -0
- data/Rakefile +4 -71
- data/examples/chart_radar.rb +127 -0
- data/examples/chart_secondary_axis.rb +1 -1
- data/lib/write_xlsx/chart/area.rb +7 -18
- data/lib/write_xlsx/chart/bar.rb +20 -23
- data/lib/write_xlsx/chart/column.rb +7 -20
- data/lib/write_xlsx/chart/radar.rb +94 -0
- data/lib/write_xlsx/chart/stock.rb +6 -0
- data/lib/write_xlsx/chart.rb +317 -116
- data/lib/write_xlsx/package/xml_writer_simple.rb +2 -2
- data/lib/write_xlsx/version.rb +5 -0
- data/test/chart/test_write_a_latin.rb +22 -0
- data/test/chart/test_write_auto.rb +1 -1
- data/test/chart/test_write_ax_id.rb +1 -1
- data/test/chart/test_write_ax_pos.rb +1 -1
- data/test/chart/test_write_cross_ax.rb +1 -1
- data/test/chart/test_write_crosses.rb +1 -1
- data/test/chart/test_write_d_lbls.rb +18 -18
- data/test/chart/test_write_idx.rb +1 -1
- data/test/chart/test_write_label_align.rb +1 -1
- data/test/chart/test_write_label_offset.rb +1 -1
- data/test/chart/test_write_lang.rb +1 -1
- data/test/chart/test_write_layout.rb +1 -1
- data/test/chart/test_write_legend.rb +1 -1
- data/test/chart/test_write_legend_pos.rb +1 -1
- data/test/chart/test_write_major_gridlines.rb +2 -2
- data/test/chart/test_write_marker.rb +1 -1
- data/test/chart/test_write_marker_size.rb +1 -1
- data/test/chart/test_write_marker_value.rb +1 -1
- data/test/chart/test_write_num_cache.rb +1 -1
- data/test/chart/test_write_number_format.rb +40 -2
- data/test/chart/test_write_order.rb +1 -1
- data/test/chart/test_write_orientation.rb +1 -1
- data/test/chart/test_write_page_margins.rb +1 -1
- data/test/chart/test_write_page_setup.rb +1 -1
- data/test/chart/test_write_plot_vis_only.rb +1 -1
- data/test/chart/test_write_pt_count.rb +1 -1
- data/test/chart/test_write_style.rb +1 -1
- data/test/chart/test_write_symbol.rb +1 -1
- data/test/chart/test_write_tick_lbl_pos.rb +1 -1
- data/test/drawing/test_write_a_graphic_frame_locks.rb +1 -1
- data/test/drawing/test_write_c_chart.rb +1 -1
- data/test/drawing/test_write_c_nv_graphic_frame_pr.rb +2 -2
- data/test/drawing/test_write_c_nv_pr.rb +1 -1
- data/test/drawing/test_write_ext.rb +1 -1
- data/test/drawing/test_write_pos.rb +1 -1
- data/test/drawing/test_write_xfrm_extension.rb +1 -1
- data/test/drawing/test_write_xfrm_offset.rb +1 -1
- data/test/helper.rb +1 -1
- data/test/package/content_types/test_write_default.rb +1 -1
- data/test/package/content_types/test_write_override.rb +1 -1
- data/test/package/table/test_write_auto_filter.rb +1 -1
- data/test/package/table/test_write_table_column.rb +1 -1
- data/test/package/table/test_write_table_style_info.rb +1 -1
- data/test/package/vml/test_write_fill.rb +1 -1
- data/test/package/vml/test_write_idmap.rb +1 -1
- data/test/package/vml/test_write_move_with_cells.rb +1 -1
- data/test/package/vml/test_write_path.rb +2 -2
- data/test/package/vml/test_write_shadow.rb +1 -1
- data/test/package/vml/test_write_shapelayout.rb +1 -1
- data/test/package/vml/test_write_shapetype.rb +1 -1
- data/test/package/vml/test_write_size_with_cells.rb +1 -1
- data/test/package/vml/test_write_stroke.rb +1 -1
- data/test/perl_output/chart_radar.xlsx +0 -0
- data/test/perl_output/chart_secondary_axis.xlsx +0 -0
- data/test/regression/test_chart_axis22.rb +45 -0
- data/test/regression/test_chart_axis23.rb +46 -0
- data/test/regression/test_chart_axis24.rb +46 -0
- data/test/regression/test_chart_font01.rb +54 -0
- data/test/regression/test_chart_font02.rb +56 -0
- data/test/regression/test_chart_font03.rb +59 -0
- data/test/regression/test_chart_font04.rb +57 -0
- data/test/regression/test_chart_font05.rb +54 -0
- data/test/regression/test_chart_font06.rb +84 -0
- data/test/regression/test_chart_radar01.rb +39 -0
- data/test/regression/test_chart_radar02.rb +43 -0
- data/test/regression/test_chart_radar03.rb +43 -0
- data/test/regression/test_escapes04.rb +30 -0
- data/test/regression/test_escapes05.rb +31 -0
- data/test/regression/test_rich_string01.rb +1 -1
- data/test/regression/test_rich_string02.rb +1 -1
- data/test/regression/test_rich_string03.rb +1 -1
- data/test/regression/test_rich_string04.rb +1 -1
- data/test/regression/test_rich_string05.rb +1 -1
- data/test/regression/test_rich_string06.rb +1 -1
- data/test/regression/test_rich_string07.rb +1 -1
- data/test/regression/test_rich_string08.rb +1 -1
- data/test/regression/test_rich_string09.rb +1 -1
- data/test/regression/test_rich_string10.rb +1 -1
- data/test/regression/test_rich_string11.rb +1 -1
- data/test/regression/test_shape_connect01.rb +1 -1
- data/test/regression/test_shape_connect02.rb +1 -1
- data/test/regression/test_shape_connect03.rb +1 -1
- data/test/regression/test_shape_connect04.rb +1 -1
- data/test/regression/xlsx_files/chart_axis22.xlsx +0 -0
- data/test/regression/xlsx_files/chart_axis23.xlsx +0 -0
- data/test/regression/xlsx_files/chart_axis24.xlsx +0 -0
- data/test/regression/xlsx_files/chart_font01.xlsx +0 -0
- data/test/regression/xlsx_files/chart_font02.xlsx +0 -0
- data/test/regression/xlsx_files/chart_font03.xlsx +0 -0
- data/test/regression/xlsx_files/chart_font04.xlsx +0 -0
- data/test/regression/xlsx_files/chart_font05.xlsx +0 -0
- data/test/regression/xlsx_files/chart_font06.xlsx +0 -0
- data/test/regression/xlsx_files/chart_radar01.xlsx +0 -0
- data/test/regression/xlsx_files/chart_radar02.xlsx +0 -0
- data/test/regression/xlsx_files/chart_radar03.xlsx +0 -0
- data/test/regression/xlsx_files/escapes04.xlsx +0 -0
- data/test/regression/xlsx_files/escapes05.xlsx +0 -0
- data/test/test_example_match.rb +119 -1
- data/test/test_xml_writer_simple.rb +4 -4
- data/test/worksheet/test_write_autofilter.rb +21 -21
- data/test/worksheet/test_write_brk.rb +1 -1
- data/test/worksheet/test_write_col_breaks.rb +2 -2
- data/test/worksheet/test_write_col_info.rb +6 -6
- data/test/worksheet/test_write_custom_filter.rb +1 -1
- data/test/worksheet/test_write_custom_filters.rb +2 -2
- data/test/worksheet/test_write_dimension.rb +9 -9
- data/test/worksheet/test_write_ext.rb +1 -1
- data/test/worksheet/test_write_ext_lst.rb +1 -1
- data/test/worksheet/test_write_filter.rb +1 -1
- data/test/worksheet/test_write_filter_column.rb +1 -1
- data/test/worksheet/test_write_filters.rb +3 -3
- data/test/worksheet/test_write_hyperlink.rb +4 -4
- data/test/worksheet/test_write_hyperlinks.rb +2 -2
- data/test/worksheet/test_write_legacy_drawing.rb +1 -1
- data/test/worksheet/test_write_merge_cell.rb +1 -1
- data/test/worksheet/test_write_mx_plv.rb +1 -1
- data/test/worksheet/test_write_page_margins.rb +11 -11
- data/test/worksheet/test_write_page_set_up_pr.rb +1 -1
- data/test/worksheet/test_write_page_setup.rb +4 -4
- data/test/worksheet/test_write_pane.rb +14 -14
- data/test/worksheet/test_write_phonetic_pr.rb +1 -1
- data/test/worksheet/test_write_print_options.rb +5 -5
- data/test/worksheet/test_write_row_breaks.rb +2 -2
- data/test/worksheet/test_write_row_element.rb +1 -1
- data/test/worksheet/test_write_selection.rb +1 -1
- data/test/worksheet/test_write_sheet_calc_pr.rb +1 -1
- data/test/worksheet/test_write_sheet_data.rb +1 -1
- data/test/worksheet/test_write_sheet_format_pr.rb +1 -1
- data/test/worksheet/test_write_sheet_pr.rb +3 -3
- data/test/worksheet/test_write_sheet_protection.rb +18 -18
- data/test/worksheet/test_write_sheet_view.rb +6 -6
- data/test/worksheet/test_write_sheet_view1.rb +6 -6
- data/test/worksheet/test_write_sheet_view2.rb +5 -5
- data/test/worksheet/test_write_sheet_view3.rb +8 -8
- data/test/worksheet/test_write_sheet_view4.rb +8 -8
- data/test/worksheet/test_write_sheet_view5.rb +7 -7
- data/test/worksheet/test_write_sheet_view6.rb +4 -4
- data/test/worksheet/test_write_sheet_view7.rb +6 -6
- data/test/worksheet/test_write_sheet_view8.rb +4 -4
- data/test/worksheet/test_write_sheet_view9.rb +4 -4
- data/test/worksheet/test_write_tab_color.rb +1 -1
- data/write_xlsx.gemspec +18 -935
- metadata +881 -32
- data/VERSION +0 -1
- data/test/chart/test_write_num_fmt.rb +0 -16
@@ -7,7 +7,7 @@ class TestWriteOverride < Test::Unit::TestCase
|
|
7
7
|
@obj = Writexlsx::Package::ContentTypes.new
|
8
8
|
@obj.__send__('write_override', '/docProps/core.xml', 'app...')
|
9
9
|
result = @obj.xml_str
|
10
|
-
expected = '<Override PartName="/docProps/core.xml" ContentType="app..."
|
10
|
+
expected = '<Override PartName="/docProps/core.xml" ContentType="app..."/>'
|
11
11
|
assert_equal(expected, result)
|
12
12
|
end
|
13
13
|
end
|
@@ -4,7 +4,7 @@ require 'write_xlsx/package/table'
|
|
4
4
|
|
5
5
|
class TestTableWriteAutoFilter01 < Test::Unit::TestCase
|
6
6
|
def test_table_write_auto_filter
|
7
|
-
expected = '<autoFilter ref="C3:F13"
|
7
|
+
expected = '<autoFilter ref="C3:F13"/>'
|
8
8
|
|
9
9
|
table = Writexlsx::Package::Table.new
|
10
10
|
table.instance_variable_get(:@properties)[:_autofilter] = 'C3:F13'
|
@@ -4,7 +4,7 @@ require 'write_xlsx/package/table'
|
|
4
4
|
|
5
5
|
class TestTableWriteTableColumn < Test::Unit::TestCase
|
6
6
|
def test_table_write_table_column
|
7
|
-
expected = '<tableColumn id="1" name="Column1"
|
7
|
+
expected = '<tableColumn id="1" name="Column1"/>'
|
8
8
|
|
9
9
|
table = Writexlsx::Package::Table.new
|
10
10
|
table.__send__(:write_table_column, {:_name => 'Column1', :_id => 1})
|
@@ -4,7 +4,7 @@ require 'write_xlsx/package/table'
|
|
4
4
|
|
5
5
|
class TestTableWriteTableStyleInfo < Test::Unit::TestCase
|
6
6
|
def test_table_write_table_style_info
|
7
|
-
expected = '<tableStyleInfo name="TableStyleMedium9" showFirstColumn="0" showLastColumn="0" showRowStripes="1" showColumnStripes="0"
|
7
|
+
expected = '<tableStyleInfo name="TableStyleMedium9" showFirstColumn="0" showLastColumn="0" showRowStripes="1" showColumnStripes="0"/>'
|
8
8
|
|
9
9
|
table = Writexlsx::Package::Table.new
|
10
10
|
table.
|
@@ -8,7 +8,7 @@ class TestWriteFill < Test::Unit::TestCase
|
|
8
8
|
vml = Writexlsx::Package::Vml.new
|
9
9
|
vml.__send__('write_fill')
|
10
10
|
result = vml.instance_variable_get(:@writer).string
|
11
|
-
expected = '<v:fill color2="#ffffe1"
|
11
|
+
expected = '<v:fill color2="#ffffe1"/>'
|
12
12
|
assert_equal(expected, result)
|
13
13
|
end
|
14
14
|
end
|
@@ -8,7 +8,7 @@ class TestWriteIdmap < Test::Unit::TestCase
|
|
8
8
|
vml = Writexlsx::Package::Vml.new
|
9
9
|
vml.__send__('write_idmap', 1)
|
10
10
|
result = vml.instance_variable_get(:@writer).string
|
11
|
-
expected = '<o:idmap v:ext="edit" data="1"
|
11
|
+
expected = '<o:idmap v:ext="edit" data="1"/>'
|
12
12
|
assert_equal(expected, result)
|
13
13
|
end
|
14
14
|
end
|
@@ -8,7 +8,7 @@ class TestWriteMoveWithCells < Test::Unit::TestCase
|
|
8
8
|
vml = Writexlsx::Package::Vml.new
|
9
9
|
vml.__send__('write_move_with_cells')
|
10
10
|
result = vml.instance_variable_get(:@writer).string
|
11
|
-
expected = '<x:MoveWithCells
|
11
|
+
expected = '<x:MoveWithCells/>'
|
12
12
|
assert_equal(expected, result)
|
13
13
|
end
|
14
14
|
end
|
@@ -8,7 +8,7 @@ class TestWritePath < Test::Unit::TestCase
|
|
8
8
|
vml = Writexlsx::Package::Vml.new
|
9
9
|
vml.__send__('write_path', 't', 'rect')
|
10
10
|
result = vml.instance_variable_get(:@writer).string
|
11
|
-
expected = '<v:path gradientshapeok="t" o:connecttype="rect"
|
11
|
+
expected = '<v:path gradientshapeok="t" o:connecttype="rect"/>'
|
12
12
|
assert_equal(expected, result)
|
13
13
|
end
|
14
14
|
|
@@ -16,7 +16,7 @@ class TestWritePath < Test::Unit::TestCase
|
|
16
16
|
vml = Writexlsx::Package::Vml.new
|
17
17
|
vml.__send__('write_path', nil, 'none')
|
18
18
|
result = vml.instance_variable_get(:@writer).string
|
19
|
-
expected = '<v:path o:connecttype="none"
|
19
|
+
expected = '<v:path o:connecttype="none"/>'
|
20
20
|
assert_equal(expected, result)
|
21
21
|
end
|
22
22
|
end
|
@@ -8,7 +8,7 @@ class TestWriteShadow < Test::Unit::TestCase
|
|
8
8
|
vml = Writexlsx::Package::Vml.new
|
9
9
|
vml.__send__('write_shadow')
|
10
10
|
result = vml.instance_variable_get(:@writer).string
|
11
|
-
expected = '<v:shadow on="t" color="black" obscured="t"
|
11
|
+
expected = '<v:shadow on="t" color="black" obscured="t"/>'
|
12
12
|
assert_equal(expected, result)
|
13
13
|
end
|
14
14
|
end
|
@@ -8,7 +8,7 @@ class TestWriteShapelayout < Test::Unit::TestCase
|
|
8
8
|
vml = Writexlsx::Package::Vml.new
|
9
9
|
vml.__send__('write_shapelayout', 1)
|
10
10
|
result = vml.instance_variable_get(:@writer).string
|
11
|
-
expected = '<o:shapelayout v:ext="edit"><o:idmap v:ext="edit" data="1"
|
11
|
+
expected = '<o:shapelayout v:ext="edit"><o:idmap v:ext="edit" data="1"/></o:shapelayout>'
|
12
12
|
assert_equal(expected, result)
|
13
13
|
end
|
14
14
|
end
|
@@ -8,7 +8,7 @@ class TestWriteShapetype < Test::Unit::TestCase
|
|
8
8
|
vml = Writexlsx::Package::Vml.new
|
9
9
|
vml.__send__('write_shapetype')
|
10
10
|
result = vml.instance_variable_get(:@writer).string
|
11
|
-
expected = '<v:shapetype id="_x0000_t202" coordsize="21600,21600" o:spt="202" path="m,l,21600r21600,l21600,xe"><v:stroke joinstyle="miter"
|
11
|
+
expected = '<v:shapetype id="_x0000_t202" coordsize="21600,21600" o:spt="202" path="m,l,21600r21600,l21600,xe"><v:stroke joinstyle="miter"/><v:path gradientshapeok="t" o:connecttype="rect"/></v:shapetype>'
|
12
12
|
assert_equal(expected, result)
|
13
13
|
end
|
14
14
|
end
|
@@ -8,7 +8,7 @@ class TestWriteSizeWithCells < Test::Unit::TestCase
|
|
8
8
|
vml = Writexlsx::Package::Vml.new
|
9
9
|
vml.__send__('write_size_with_cells')
|
10
10
|
result = vml.instance_variable_get(:@writer).string
|
11
|
-
expected = '<x:SizeWithCells
|
11
|
+
expected = '<x:SizeWithCells/>'
|
12
12
|
assert_equal(expected, result)
|
13
13
|
end
|
14
14
|
end
|
@@ -8,7 +8,7 @@ class TestWriteStroke < Test::Unit::TestCase
|
|
8
8
|
vml = Writexlsx::Package::Vml.new
|
9
9
|
vml.__send__('write_stroke')
|
10
10
|
result = vml.instance_variable_get(:@writer).string
|
11
|
-
expected = '<v:stroke joinstyle="miter"
|
11
|
+
expected = '<v:stroke joinstyle="miter"/>'
|
12
12
|
assert_equal(expected, result)
|
13
13
|
end
|
14
14
|
end
|
Binary file
|
Binary file
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionChartAxis22 < Test::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
File.delete(@xlsx) if File.exist?(@xlsx)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_chart_axis22
|
14
|
+
@xlsx = 'chart_axis22.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
chart = workbook.add_chart(:type => 'column', :embedded => 1)
|
18
|
+
|
19
|
+
# For testing, copy the randomly generated axis ids in the target xlsx file.
|
20
|
+
chart.instance_variable_set(:@axis_ids, [86799104, 86801792 ])
|
21
|
+
|
22
|
+
data = [
|
23
|
+
[ 1, 2, 3, 4, 5 ],
|
24
|
+
[ 2, 4, 6, 8, 10 ],
|
25
|
+
[ 3, 6, 9, 12, 15 ]
|
26
|
+
]
|
27
|
+
|
28
|
+
worksheet.write('A1', data)
|
29
|
+
|
30
|
+
chart.add_series(:values => '=Sheet1!$A$1:$A$5')
|
31
|
+
chart.add_series(:values => '=Sheet1!$B$1:$B$5')
|
32
|
+
chart.add_series(:values => '=Sheet1!$C$1:$C$5')
|
33
|
+
|
34
|
+
chart.set_x_axis(:num_format => '#,##0.00')
|
35
|
+
|
36
|
+
worksheet.insert_chart('E9', chart)
|
37
|
+
|
38
|
+
workbook.close
|
39
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx),
|
40
|
+
@xlsx,
|
41
|
+
nil,
|
42
|
+
{'xl/charts/chart1.xml' => ['<c:pageMargins']}
|
43
|
+
)
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionChartAxis23 < Test::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
File.delete(@xlsx) if File.exist?(@xlsx)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_chart_axis23
|
14
|
+
@xlsx = 'chart_axis23.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
chart = workbook.add_chart(:type => 'column', :embedded => 1)
|
18
|
+
|
19
|
+
# For testing, copy the randomly generated axis ids in the target xlsx file.
|
20
|
+
chart.instance_variable_set(:@axis_ids, [46332160, 47470848])
|
21
|
+
|
22
|
+
data = [
|
23
|
+
[ 1, 2, 3, 4, 5 ],
|
24
|
+
[ 2, 4, 6, 8, 10 ],
|
25
|
+
[ 3, 6, 9, 12, 15 ]
|
26
|
+
]
|
27
|
+
|
28
|
+
worksheet.write('A1', data)
|
29
|
+
|
30
|
+
chart.add_series(:values => '=Sheet1!$A$1:$A$5')
|
31
|
+
chart.add_series(:values => '=Sheet1!$B$1:$B$5')
|
32
|
+
chart.add_series(:values => '=Sheet1!$C$1:$C$5')
|
33
|
+
|
34
|
+
chart.set_x_axis(:num_format => 'dd/mm/yyyy')
|
35
|
+
chart.set_y_axis(:num_format => '0.00%')
|
36
|
+
|
37
|
+
worksheet.insert_chart('E9', chart)
|
38
|
+
|
39
|
+
workbook.close
|
40
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx),
|
41
|
+
@xlsx,
|
42
|
+
nil,
|
43
|
+
{'xl/charts/chart1.xml' => ['<c:pageMargins']}
|
44
|
+
)
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionChartAxis24 < Test::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
File.delete(@xlsx) if File.exist?(@xlsx)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_chart_axis24
|
14
|
+
@xlsx = 'chart_axis24.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
chart = workbook.add_chart(:type => 'column', :embedded => 1)
|
18
|
+
|
19
|
+
# For testing, copy the randomly generated axis ids in the target xlsx file.
|
20
|
+
chart.instance_variable_set(:@axis_ids, [47471232, 48509696])
|
21
|
+
|
22
|
+
data = [
|
23
|
+
[ 1, 2, 3, 4, 5 ],
|
24
|
+
[ 2, 4, 6, 8, 10 ],
|
25
|
+
[ 3, 6, 9, 12, 15 ]
|
26
|
+
]
|
27
|
+
|
28
|
+
worksheet.write('A1', data)
|
29
|
+
|
30
|
+
chart.add_series(:values => '=Sheet1!$A$1:$A$5')
|
31
|
+
chart.add_series(:values => '=Sheet1!$B$1:$B$5')
|
32
|
+
chart.add_series(:values => '=Sheet1!$C$1:$C$5')
|
33
|
+
|
34
|
+
chart.set_x_axis(:num_format => 'dd/mm/yyyy', :num_format_linked => 1)
|
35
|
+
chart.set_y_axis(:num_format => '0.00%')
|
36
|
+
|
37
|
+
worksheet.insert_chart('E9', chart)
|
38
|
+
|
39
|
+
workbook.close
|
40
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx),
|
41
|
+
@xlsx,
|
42
|
+
nil,
|
43
|
+
{'xl/charts/chart1.xml' => ['<c:pageMargins']}
|
44
|
+
)
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionChartFont01 < Test::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
File.delete(@xlsx) if File.exist?(@xlsx)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_chart_area01
|
14
|
+
@xlsx = 'chart_font01.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
chart = workbook.add_chart(:type => 'bar', :embedded => 1)
|
18
|
+
|
19
|
+
# For testing, copy the randomly generated axis ids in the target xlsx file.
|
20
|
+
chart.instance_variable_set(:@axis_ids, [43945344, 45705856])
|
21
|
+
|
22
|
+
data = [
|
23
|
+
[1, 2, 3, 4, 5],
|
24
|
+
[2, 4, 6, 8, 10],
|
25
|
+
[3, 6, 9, 12, 15]
|
26
|
+
]
|
27
|
+
|
28
|
+
worksheet.write('A1', data)
|
29
|
+
|
30
|
+
chart.add_series(:values => '=Sheet1!$A$1:$A$5')
|
31
|
+
chart.add_series(:values => '=Sheet1!$B$1:$B$5')
|
32
|
+
chart.add_series(:values => '=Sheet1!$C$1:$C$5')
|
33
|
+
|
34
|
+
chart.set_title(:name => 'Title')
|
35
|
+
|
36
|
+
chart.set_x_axis(
|
37
|
+
:name => 'XXX',
|
38
|
+
:num_font => { :size => 11, :bold => 1, :italic => 1 }
|
39
|
+
)
|
40
|
+
|
41
|
+
chart.set_y_axis(
|
42
|
+
:name => 'YYY',
|
43
|
+
:num_font => { :size => 9, :bold => 0, :italic => 1 }
|
44
|
+
)
|
45
|
+
|
46
|
+
worksheet.insert_chart('E9', chart)
|
47
|
+
|
48
|
+
workbook.close
|
49
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx,
|
50
|
+
nil,
|
51
|
+
{ 'xl/charts/chart1.xml' => ['<c:pageMargins'] }
|
52
|
+
)
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionChartFont02 < Test::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
File.delete(@xlsx) if File.exist?(@xlsx)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_chart_area02
|
14
|
+
@xlsx = 'chart_font02.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
chart = workbook.add_chart(:type => 'bar', :embedded => 1)
|
18
|
+
|
19
|
+
# For testing, copy the randomly generated axis ids in the target xlsx file.
|
20
|
+
chart.instance_variable_set(:@axis_ids, [43945344, 45705856])
|
21
|
+
|
22
|
+
data = [
|
23
|
+
[1, 2, 3, 4, 5],
|
24
|
+
[2, 4, 6, 8, 10],
|
25
|
+
[3, 6, 9, 12, 15]
|
26
|
+
]
|
27
|
+
|
28
|
+
worksheet.write('A1', data)
|
29
|
+
|
30
|
+
chart.add_series(:values => '=Sheet1!$A$1:$A$5')
|
31
|
+
chart.add_series(:values => '=Sheet1!$B$1:$B$5')
|
32
|
+
chart.add_series(:values => '=Sheet1!$C$1:$C$5')
|
33
|
+
|
34
|
+
chart.set_title(:name => 'Title')
|
35
|
+
|
36
|
+
chart.set_x_axis(
|
37
|
+
:name => 'XXX',
|
38
|
+
:name_font => { :bold => 0, :italic => 1 },
|
39
|
+
:num_font => { :size => 11, :bold => 1, :italic => 1 }
|
40
|
+
)
|
41
|
+
|
42
|
+
chart.set_y_axis(
|
43
|
+
:name => 'YYY',
|
44
|
+
:name_font => { :bold => 1, :italic => 1 },
|
45
|
+
:num_font => { :size => 9, :bold => 0, :italic => 1 },
|
46
|
+
)
|
47
|
+
|
48
|
+
worksheet.insert_chart('E9', chart)
|
49
|
+
|
50
|
+
workbook.close
|
51
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx,
|
52
|
+
nil,
|
53
|
+
{ 'xl/charts/chart1.xml' => ['<c:pageMargins'] }
|
54
|
+
)
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionChartFont03 < Test::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
File.delete(@xlsx) if File.exist?(@xlsx)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_chart_area03
|
14
|
+
@xlsx = 'chart_font03.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
chart = workbook.add_chart(:type => 'bar', :embedded => 1)
|
18
|
+
|
19
|
+
# For testing, copy the randomly generated axis ids in the target xlsx file.
|
20
|
+
chart.instance_variable_set(:@axis_ids, [45704704, 45716224])
|
21
|
+
|
22
|
+
data = [
|
23
|
+
[1, 2, 3, 4, 5],
|
24
|
+
[2, 4, 6, 8, 10],
|
25
|
+
[3, 6, 9, 12, 15]
|
26
|
+
]
|
27
|
+
|
28
|
+
worksheet.write('A1', data)
|
29
|
+
|
30
|
+
chart.add_series(:values => '=Sheet1!$A$1:$A$5')
|
31
|
+
chart.add_series(:values => '=Sheet1!$B$1:$B$5')
|
32
|
+
chart.add_series(:values => '=Sheet1!$C$1:$C$5')
|
33
|
+
|
34
|
+
chart.set_title(
|
35
|
+
:name => 'Title',
|
36
|
+
:name_font => { :bold => 0, :italic => 1 }
|
37
|
+
)
|
38
|
+
|
39
|
+
chart.set_x_axis(
|
40
|
+
:name => 'XXX',
|
41
|
+
:name_font => { :bold => 0, :italic => 1 },
|
42
|
+
:num_font => { :size => 11, :bold => 1, :italic => 1 }
|
43
|
+
)
|
44
|
+
|
45
|
+
chart.set_y_axis(
|
46
|
+
:name => 'YYY',
|
47
|
+
:name_font => { :bold => 1, :italic => 1 },
|
48
|
+
:num_font => { :size => 9, :bold => 0, :italic => 1 }
|
49
|
+
)
|
50
|
+
|
51
|
+
worksheet.insert_chart('E9', chart)
|
52
|
+
|
53
|
+
workbook.close
|
54
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx,
|
55
|
+
nil,
|
56
|
+
{ 'xl/charts/chart1.xml' => ['<c:pageMargins'] }
|
57
|
+
)
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionChartFont04 < Test::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
File.delete(@xlsx) if File.exist?(@xlsx)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_chart_area04
|
14
|
+
@xlsx = 'chart_font04.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
chart = workbook.add_chart(:type => 'bar', :embedded => 1)
|
18
|
+
|
19
|
+
# For testing, copy the randomly generated axis ids in the target xlsx file.
|
20
|
+
chart.instance_variable_set(:@axis_ids, [43944960, 45705472])
|
21
|
+
|
22
|
+
data = [
|
23
|
+
[1, 2, 3, 4, 5],
|
24
|
+
[2, 4, 6, 8, 10],
|
25
|
+
[3, 6, 9, 12, 15]
|
26
|
+
]
|
27
|
+
|
28
|
+
worksheet.write('A1', data)
|
29
|
+
|
30
|
+
chart.add_series(:values => '=Sheet1!$A$1:$A$5')
|
31
|
+
chart.add_series(:values => '=Sheet1!$B$1:$B$5')
|
32
|
+
chart.add_series(:values => '=Sheet1!$C$1:$C$5')
|
33
|
+
|
34
|
+
chart.set_title(
|
35
|
+
:name => '=Sheet1!$A$1',
|
36
|
+
:name_font => { :bold => 0, :italic => 1 }
|
37
|
+
)
|
38
|
+
|
39
|
+
chart.set_x_axis(
|
40
|
+
:name => '=Sheet1!$A$2',
|
41
|
+
:name_font => { :bold => 0, :italic => 1 }
|
42
|
+
)
|
43
|
+
|
44
|
+
chart.set_y_axis(
|
45
|
+
:name => '=Sheet1!$A$3',
|
46
|
+
:name_font => { :bold => 1, :italic => 1 }
|
47
|
+
)
|
48
|
+
|
49
|
+
worksheet.insert_chart('E9', chart)
|
50
|
+
|
51
|
+
workbook.close
|
52
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx,
|
53
|
+
nil,
|
54
|
+
{ 'xl/charts/chart1.xml' => ['<c:pageMargins'] }
|
55
|
+
)
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionChartFont05 < Test::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
File.delete(@xlsx) if File.exist?(@xlsx)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_chart_area05
|
14
|
+
@xlsx = 'chart_font05.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
chart = workbook.add_chart(:type => 'bar', :embedded => 1)
|
18
|
+
|
19
|
+
# For testing, copy the randomly generated axis ids in the target xlsx file.
|
20
|
+
chart.instance_variable_set(:@axis_ids, [49407488, 53740288])
|
21
|
+
|
22
|
+
data = [
|
23
|
+
[1, 2, 3, 4, 5],
|
24
|
+
[2, 4, 6, 8, 10],
|
25
|
+
[3, 6, 9, 12, 15]
|
26
|
+
]
|
27
|
+
|
28
|
+
worksheet.write('A1', data)
|
29
|
+
|
30
|
+
chart.add_series(:values => '=Sheet1!$A$1:$A$5')
|
31
|
+
chart.add_series(:values => '=Sheet1!$B$1:$B$5')
|
32
|
+
chart.add_series(:values => '=Sheet1!$C$1:$C$5')
|
33
|
+
|
34
|
+
chart.set_title(:name => 'Title')
|
35
|
+
|
36
|
+
chart.set_x_axis(
|
37
|
+
:name => 'XXX',
|
38
|
+
:num_font => { :name => 'Arial', :pitch_family => 34, :charset => 0 }
|
39
|
+
)
|
40
|
+
|
41
|
+
chart.set_y_axis(
|
42
|
+
:name => 'YYY',
|
43
|
+
:num_font => { :bold => 1, :italic => 1, :underline => 1 }
|
44
|
+
)
|
45
|
+
|
46
|
+
worksheet.insert_chart('E9', chart)
|
47
|
+
|
48
|
+
workbook.close
|
49
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx,
|
50
|
+
nil,
|
51
|
+
{ 'xl/charts/chart1.xml' => ['<c:pageMargins'] }
|
52
|
+
)
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionChartFont06 < Test::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
File.delete(@xlsx) if File.exist?(@xlsx)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_chart_area06
|
14
|
+
@xlsx = 'chart_font06.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
chart = workbook.add_chart(:type => 'bar', :embedded => 1)
|
18
|
+
|
19
|
+
# For testing, copy the randomly generated axis ids in the target xlsx file.
|
20
|
+
chart.instance_variable_set(:@axis_ids, [49407488, 53740288])
|
21
|
+
|
22
|
+
data = [
|
23
|
+
[1, 2, 3, 4, 5],
|
24
|
+
[2, 4, 6, 8, 10],
|
25
|
+
[3, 6, 9, 12, 15]
|
26
|
+
]
|
27
|
+
|
28
|
+
worksheet.write('A1', data)
|
29
|
+
|
30
|
+
chart.add_series(:values => '=Sheet1!$A$1:$A$5')
|
31
|
+
chart.add_series(:values => '=Sheet1!$B$1:$B$5')
|
32
|
+
chart.add_series(:values => '=Sheet1!$C$1:$C$5')
|
33
|
+
|
34
|
+
chart.set_title(
|
35
|
+
:name => 'Title',
|
36
|
+
:name_font => {
|
37
|
+
:name => 'Calibri',
|
38
|
+
:pitch_family => 34,
|
39
|
+
:charset => 0,
|
40
|
+
:color => 'yellow'
|
41
|
+
}
|
42
|
+
)
|
43
|
+
|
44
|
+
chart.set_x_axis(
|
45
|
+
:name => 'XXX',
|
46
|
+
:name_font => {
|
47
|
+
:name => 'Courier New',
|
48
|
+
:pitch_family => 49,
|
49
|
+
:charset => 0,
|
50
|
+
:color => '#92D050'
|
51
|
+
},
|
52
|
+
:num_font => {
|
53
|
+
:name => 'Arial',
|
54
|
+
:pitch_family => 34,
|
55
|
+
:charset => 0,
|
56
|
+
:color => '#00B0F0'
|
57
|
+
},
|
58
|
+
)
|
59
|
+
|
60
|
+
chart.set_y_axis(
|
61
|
+
:name => 'YYY',
|
62
|
+
:name_font => {
|
63
|
+
:name => 'Century',
|
64
|
+
:pitch_family => 18,
|
65
|
+
:charset => 0,
|
66
|
+
:color => 'red'
|
67
|
+
},
|
68
|
+
:num_font => {
|
69
|
+
:bold => 1,
|
70
|
+
:italic => 1,
|
71
|
+
:underline => 1,
|
72
|
+
:color => '#7030A0',
|
73
|
+
}
|
74
|
+
)
|
75
|
+
|
76
|
+
worksheet.insert_chart('E9', chart)
|
77
|
+
|
78
|
+
workbook.close
|
79
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx,
|
80
|
+
nil,
|
81
|
+
{ 'xl/charts/chart1.xml' => ['<c:pageMargins'] }
|
82
|
+
)
|
83
|
+
end
|
84
|
+
end
|