write_xlsx 0.89.0 → 1.01.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Changes +98 -0
- data/LICENSE.txt +1 -1
- data/README.md +2 -2
- data/examples/a_simple.rb +2 -7
- data/examples/add_vba_project.rb +1 -1
- data/examples/array_formula.rb +1 -1
- data/examples/chart_area.rb +5 -2
- data/examples/chart_bar.rb +5 -2
- data/examples/chart_clustered.rb +1 -1
- data/examples/chart_column.rb +5 -2
- data/examples/chart_combined.rb +1 -1
- data/examples/chart_data_table.rb +9 -3
- data/examples/chart_data_tools.rb +25 -7
- data/examples/chart_doughnut.rb +17 -5
- data/examples/chart_gauge.rb +73 -0
- data/examples/chart_line.rb +5 -2
- data/examples/chart_pareto.rb +1 -1
- data/examples/chart_pie.rb +9 -3
- data/examples/chart_radar.rb +13 -4
- data/examples/chart_scatter.rb +5 -2
- data/examples/chart_secondary_axis.rb +5 -2
- data/examples/chart_stock.rb +1 -1
- data/examples/chart_styles.rb +1 -1
- data/examples/colors.rb +1 -1
- data/examples/conditional_format.rb +73 -46
- data/examples/data_validate.rb +1 -1
- data/examples/date_time.rb +1 -1
- data/examples/demo.rb +5 -8
- data/examples/formats.rb +1 -1
- data/examples/headers.rb +1 -1
- data/examples/hide_row_col.rb +1 -1
- data/examples/hide_sheet.rb +1 -1
- data/examples/hyperlink1.rb +5 -12
- data/examples/indent.rb +1 -1
- data/examples/macros.rb +1 -1
- data/examples/merge1.rb +1 -1
- data/examples/merge2.rb +1 -1
- data/examples/merge3.rb +1 -1
- data/examples/merge4.rb +1 -1
- data/examples/merge5.rb +1 -1
- data/examples/merge6.rb +1 -1
- data/examples/outline.rb +1 -1
- data/examples/outline_collapsed.rb +1 -1
- data/examples/panes.rb +1 -1
- data/examples/properties.rb +1 -1
- data/examples/regions.rb +1 -1
- data/examples/rich_strings.rb +1 -1
- data/examples/right_to_left.rb +1 -1
- data/examples/shape1.rb +1 -1
- data/examples/shape2.rb +1 -1
- data/examples/shape3.rb +1 -1
- data/examples/shape4.rb +1 -1
- data/examples/shape5.rb +1 -1
- data/examples/shape6.rb +1 -1
- data/examples/shape7.rb +1 -1
- data/examples/shape8.rb +1 -1
- data/examples/shape_all.rb +1 -1
- data/examples/sparklines1.rb +1 -1
- data/examples/sparklines2.rb +1 -1
- data/examples/stats.rb +1 -1
- data/examples/stats_ext.rb +1 -1
- data/examples/stocks.rb +1 -1
- data/examples/tab_colors.rb +1 -1
- data/examples/tables.rb +1 -1
- data/lib/write_xlsx/chart.rb +124 -240
- data/lib/write_xlsx/chart/area.rb +1 -1
- data/lib/write_xlsx/chart/axis.rb +4 -4
- data/lib/write_xlsx/chart/bar.rb +1 -1
- data/lib/write_xlsx/chart/caption.rb +3 -1
- data/lib/write_xlsx/chart/column.rb +1 -1
- data/lib/write_xlsx/chart/doughnut.rb +1 -1
- data/lib/write_xlsx/chart/legend.rb +14 -0
- data/lib/write_xlsx/chart/line.rb +1 -1
- data/lib/write_xlsx/chart/pie.rb +32 -15
- data/lib/write_xlsx/chart/radar.rb +1 -1
- data/lib/write_xlsx/chart/scatter.rb +1 -1
- data/lib/write_xlsx/chart/series.rb +11 -7
- data/lib/write_xlsx/chart/stock.rb +1 -1
- data/lib/write_xlsx/chartsheet.rb +35 -7
- data/lib/write_xlsx/drawing.rb +28 -8
- data/lib/write_xlsx/format.rb +19 -15
- data/lib/write_xlsx/package/comments.rb +57 -54
- data/lib/write_xlsx/package/conditional_format.rb +360 -39
- data/lib/write_xlsx/package/content_types.rb +10 -0
- data/lib/write_xlsx/package/core.rb +8 -6
- data/lib/write_xlsx/package/custom.rb +125 -0
- data/lib/write_xlsx/package/packager.rb +26 -0
- data/lib/write_xlsx/package/styles.rb +53 -21
- data/lib/write_xlsx/package/table.rb +16 -4
- data/lib/write_xlsx/shape.rb +4 -3
- data/lib/write_xlsx/sheets.rb +11 -1
- data/lib/write_xlsx/sparkline.rb +1 -1
- data/lib/write_xlsx/utility.rb +305 -35
- data/lib/write_xlsx/version.rb +1 -1
- data/lib/write_xlsx/workbook.rb +132 -12
- data/lib/write_xlsx/worksheet.rb +397 -163
- data/lib/write_xlsx/worksheet/data_validation.rb +10 -14
- data/lib/write_xlsx/worksheet/hyperlink.rb +4 -13
- data/test/chart/test_write_legend_pos.rb +9 -1
- data/test/chartsheet/test_write_sheet_protection.rb +91 -0
- data/test/drawing/test_drawing_chart_01.rb +6 -2
- data/test/drawing/test_drawing_image_01.rb +12 -3
- data/test/drawing/test_drawing_shape_01.rb +8 -5
- data/test/drawing/test_drawing_shape_02.rb +12 -5
- data/test/drawing/test_drawing_shape_03.rb +8 -5
- data/test/drawing/test_drawing_shape_04.rb +8 -24
- data/test/drawing/test_drawing_shape_05.rb +8 -5
- data/test/drawing/test_drawing_shape_06.rb +11 -6
- data/test/drawing/test_drawing_shape_07.rb +11 -6
- 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 +1 -1
- data/test/drawing/test_write_c_nv_pr.rb +1 -1
- data/test/drawing/test_write_col.rb +1 -1
- data/test/drawing/test_write_col_off.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_row.rb +1 -1
- data/test/drawing/test_write_row_off.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 +6 -1
- data/test/package/comments/test_comments_01.rb +54 -0
- data/test/package/comments/test_comments_02.rb +54 -0
- data/test/perl_output/chart_gauge.xlsx +0 -0
- data/test/perl_output/formats.xlsx +0 -0
- data/test/regression/_test_hyperlink31.rb +26 -0
- data/test/regression/images/happy.jpg +0 -0
- data/test/regression/images/zero_dpi.jpg +0 -0
- data/test/regression/test_array_formula03.rb +36 -0
- data/test/regression/test_autofilter08.rb +110 -0
- data/test/regression/test_autofilter09.rb +110 -0
- data/test/regression/test_autofilter10.rb +110 -0
- data/test/regression/test_chart_axis26.rb +10 -8
- data/test/regression/test_chart_axis27.rb +1 -1
- data/test/regression/test_chart_axis28.rb +1 -1
- data/test/regression/test_chart_axis29.rb +1 -1
- data/test/regression/test_chart_axis33.rb +1 -1
- data/test/regression/test_chart_axis42.rb +44 -0
- data/test/regression/test_chart_axis43.rb +44 -0
- data/test/regression/test_chart_axis44.rb +54 -0
- data/test/regression/test_chart_axis45.rb +54 -0
- data/test/regression/test_chart_axis46.rb +54 -0
- data/test/regression/test_chart_bar08.rb +3 -0
- data/test/regression/test_chart_bar11.rb +3 -0
- data/test/regression/test_chart_bar14.rb +3 -0
- data/test/regression/test_chart_chartarea05.rb +16 -17
- data/test/regression/test_chart_chartarea06.rb +49 -0
- data/test/regression/test_chart_combined10.rb +43 -0
- data/test/regression/test_chart_combined11.rb +63 -0
- data/test/regression/test_chart_data_labels25.rb +61 -0
- data/test/regression/test_chart_doughnut07.rb +37 -0
- data/test/regression/test_chart_font09.rb +1 -1
- data/test/regression/test_chart_format26.rb +48 -0
- data/test/regression/test_chart_format27.rb +58 -0
- data/test/regression/test_chart_format28.rb +52 -0
- data/test/regression/test_chart_format29.rb +59 -0
- data/test/regression/test_chart_format30.rb +53 -0
- data/test/regression/test_chart_format31.rb +60 -0
- data/test/regression/test_chart_legend03.rb +41 -0
- data/test/regression/test_chart_legend04.rb +41 -0
- data/test/regression/test_chart_legend05.rb +41 -0
- data/test/regression/test_chart_legend06.rb +41 -0
- data/test/regression/test_chart_legend07.rb +38 -0
- data/test/regression/test_chart_size03.rb +4 -1
- data/test/regression/test_chart_table03.rb +56 -0
- data/test/regression/test_comment13.rb +36 -0
- data/test/regression/test_comment14.rb +29 -0
- data/test/regression/test_cond_format14.rb +42 -0
- data/test/regression/test_cond_format15.rb +53 -0
- data/test/regression/test_cond_format16.rb +53 -0
- data/test/regression/test_cond_format17.rb +37 -0
- data/test/regression/test_cond_format18.rb +136 -0
- data/test/regression/test_cond_format19.rb +64 -0
- data/test/regression/test_cond_format20.rb +43 -0
- data/test/regression/test_date_1904_01.rb +1 -1
- data/test/regression/test_escapes04.rb +3 -0
- data/test/regression/test_escapes05.rb +3 -0
- data/test/regression/test_escapes07.rb +3 -0
- data/test/regression/test_escapes08.rb +3 -0
- data/test/regression/test_format15.rb +26 -0
- data/test/regression/test_hyperlink01.rb +3 -0
- data/test/regression/test_hyperlink02.rb +3 -0
- data/test/regression/test_hyperlink03.rb +4 -0
- data/test/regression/test_hyperlink04.rb +3 -0
- data/test/regression/test_hyperlink05.rb +3 -0
- data/test/regression/test_hyperlink06.rb +3 -0
- data/test/regression/test_hyperlink07.rb +3 -0
- data/test/regression/test_hyperlink08.rb +3 -0
- data/test/regression/test_hyperlink09.rb +3 -0
- data/test/regression/test_hyperlink10.rb +3 -0
- data/test/regression/test_hyperlink11.rb +3 -0
- data/test/regression/test_hyperlink12.rb +3 -0
- data/test/regression/test_hyperlink13.rb +3 -0
- data/test/regression/test_hyperlink14.rb +3 -0
- data/test/regression/test_hyperlink15.rb +3 -0
- data/test/regression/test_hyperlink16.rb +3 -0
- data/test/regression/test_hyperlink17.rb +3 -0
- data/test/regression/test_hyperlink18.rb +3 -0
- data/test/regression/test_hyperlink20.rb +3 -0
- data/test/regression/test_hyperlink21.rb +3 -0
- data/test/regression/test_hyperlink22.rb +3 -0
- data/test/regression/test_hyperlink23.rb +3 -0
- data/test/regression/test_hyperlink24.rb +3 -0
- data/test/regression/test_hyperlink25.rb +3 -0
- data/test/regression/test_hyperlink26.rb +3 -0
- data/test/regression/test_hyperlink27.rb +27 -0
- data/test/regression/test_hyperlink28.rb +50 -0
- data/test/regression/test_hyperlink29.rb +27 -0
- data/test/regression/test_hyperlink30.rb +36 -0
- data/test/regression/test_image08.rb +5 -4
- data/test/regression/test_image15.rb +4 -2
- data/test/regression/test_image28.rb +1 -1
- data/test/regression/test_image35.rb +26 -0
- data/test/regression/test_image36.rb +26 -0
- data/test/regression/test_image44.rb +28 -0
- data/test/regression/test_image45.rb +28 -0
- data/test/regression/test_image46.rb +29 -0
- data/test/regression/test_image47.rb +28 -0
- data/test/regression/test_object_position01.rb +26 -0
- data/test/regression/test_object_position02.rb +26 -0
- data/test/regression/test_object_position03.rb +26 -0
- data/test/regression/test_object_position04.rb +44 -0
- data/test/regression/test_object_position06.rb +28 -0
- data/test/regression/test_object_position07.rb +28 -0
- data/test/regression/test_object_position08.rb +47 -0
- data/test/regression/test_object_position09.rb +50 -0
- data/test/regression/test_object_position10.rb +28 -0
- data/test/regression/test_properties01.rb +1 -4
- data/test/regression/test_properties02.rb +1 -4
- data/test/regression/test_properties03.rb +26 -0
- data/test/regression/test_properties04.rb +61 -0
- data/test/regression/test_properties05.rb +30 -0
- data/test/regression/test_shape_connect01.rb +4 -2
- data/test/regression/test_table03.rb +3 -0
- data/test/regression/test_table04.rb +3 -0
- data/test/regression/test_table05.rb +3 -0
- data/test/regression/test_table06.rb +3 -0
- data/test/regression/test_table20.rb +34 -0
- data/test/regression/test_table21.rb +36 -0
- data/test/regression/test_table22.rb +32 -0
- data/test/regression/test_table23.rb +56 -0
- data/test/regression/test_utf8_11.rb +23 -0
- data/test/regression/xlsx_files/array_formula03.xlsx +0 -0
- data/test/regression/xlsx_files/autofilter08.xlsx +0 -0
- data/test/regression/xlsx_files/autofilter09.xlsx +0 -0
- data/test/regression/xlsx_files/autofilter10.xlsx +0 -0
- data/test/regression/xlsx_files/chart_axis26.xlsx +0 -0
- data/test/regression/xlsx_files/chart_axis27.xlsx +0 -0
- data/test/regression/xlsx_files/chart_axis28.xlsx +0 -0
- data/test/regression/xlsx_files/chart_axis29.xlsx +0 -0
- data/test/regression/xlsx_files/chart_axis33.xlsx +0 -0
- data/test/regression/xlsx_files/chart_axis42.xlsx +0 -0
- data/test/regression/xlsx_files/chart_axis43.xlsx +0 -0
- data/test/regression/xlsx_files/chart_axis44.xlsx +0 -0
- data/test/regression/xlsx_files/chart_axis45.xlsx +0 -0
- data/test/regression/xlsx_files/chart_axis46.xlsx +0 -0
- data/test/regression/xlsx_files/chart_chartarea05.xlsx +0 -0
- data/test/regression/xlsx_files/chart_chartarea06.xlsx +0 -0
- data/test/regression/xlsx_files/chart_combined10.xlsx +0 -0
- data/test/regression/xlsx_files/chart_combined11.xlsx +0 -0
- data/test/regression/xlsx_files/chart_data_labels25.xlsx +0 -0
- data/test/regression/xlsx_files/chart_doughnut07.xlsx +0 -0
- data/test/regression/xlsx_files/chart_font09.xlsx +0 -0
- data/test/regression/xlsx_files/chart_format26.xlsx +0 -0
- data/test/regression/xlsx_files/chart_format27.xlsx +0 -0
- data/test/regression/xlsx_files/chart_format28.xlsx +0 -0
- data/test/regression/xlsx_files/chart_format29.xlsx +0 -0
- data/test/regression/xlsx_files/chart_format30.xlsx +0 -0
- data/test/regression/xlsx_files/chart_format31.xlsx +0 -0
- data/test/regression/xlsx_files/chart_legend03.xlsx +0 -0
- data/test/regression/xlsx_files/chart_legend04.xlsx +0 -0
- data/test/regression/xlsx_files/chart_legend05.xlsx +0 -0
- data/test/regression/xlsx_files/chart_legend06.xlsx +0 -0
- data/test/regression/xlsx_files/chart_legend07.xlsx +0 -0
- data/test/regression/xlsx_files/chart_table03.xlsx +0 -0
- data/test/regression/xlsx_files/comment13.xlsx +0 -0
- data/test/regression/xlsx_files/comment14.xlsx +0 -0
- data/test/regression/xlsx_files/cond_format14.xlsx +0 -0
- data/test/regression/xlsx_files/cond_format15.xlsx +0 -0
- data/test/regression/xlsx_files/cond_format16.xlsx +0 -0
- data/test/regression/xlsx_files/cond_format17.xlsx +0 -0
- data/test/regression/xlsx_files/cond_format18.xlsx +0 -0
- data/test/regression/xlsx_files/cond_format19.xlsx +0 -0
- data/test/regression/xlsx_files/cond_format20.xlsx +0 -0
- data/test/regression/xlsx_files/date_1904_01.xlsx +0 -0
- data/test/regression/xlsx_files/format15.xlsx +0 -0
- data/test/regression/xlsx_files/hyperlink27.xlsx +0 -0
- data/test/regression/xlsx_files/hyperlink28.xlsx +0 -0
- data/test/regression/xlsx_files/hyperlink29.xlsx +0 -0
- data/test/regression/xlsx_files/hyperlink30.xlsx +0 -0
- data/test/regression/xlsx_files/hyperlink31.xlsx +0 -0
- data/test/regression/xlsx_files/image35.xlsx +0 -0
- data/test/regression/xlsx_files/image36.xlsx +0 -0
- data/test/regression/xlsx_files/image44.xlsx +0 -0
- data/test/regression/xlsx_files/image45.xlsx +0 -0
- data/test/regression/xlsx_files/image46.xlsx +0 -0
- data/test/regression/xlsx_files/image47.xlsx +0 -0
- data/test/regression/xlsx_files/object_position01.xlsx +0 -0
- data/test/regression/xlsx_files/object_position02.xlsx +0 -0
- data/test/regression/xlsx_files/object_position03.xlsx +0 -0
- data/test/regression/xlsx_files/object_position04.xlsx +0 -0
- data/test/regression/xlsx_files/object_position06.xlsx +0 -0
- data/test/regression/xlsx_files/object_position07.xlsx +0 -0
- data/test/regression/xlsx_files/object_position08.xlsx +0 -0
- data/test/regression/xlsx_files/object_position09.xlsx +0 -0
- data/test/regression/xlsx_files/object_position10.xlsx +0 -0
- data/test/regression/xlsx_files/properties03.xlsx +0 -0
- data/test/regression/xlsx_files/properties04.xlsx +0 -0
- data/test/regression/xlsx_files/properties05.xlsx +0 -0
- data/test/regression/xlsx_files/table21.xlsx +0 -0
- data/test/regression/xlsx_files/table22.xlsx +0 -0
- data/test/regression/xlsx_files/table23.xlsx +0 -0
- data/test/regression/xlsx_files/utf8_11.xlsx +0 -0
- data/test/test_example_match.rb +836 -771
- data/test/workbook/test_check_sheetname.rb +61 -0
- data/test/workbook/test_worksheet_by_name.rb +35 -0
- data/test/workbook/test_write_workbook_view.rb +117 -0
- data/test/worksheet/test_cond_format_22.rb +266 -0
- data/test/worksheet/test_cond_format_23.rb +242 -0
- data/test/worksheet/test_cond_format_24.rb +303 -0
- data/test/worksheet/test_data_bar_01.rb +53 -0
- data/test/worksheet/test_data_bar_02.rb +79 -0
- data/test/worksheet/test_data_bar_03.rb +147 -0
- data/test/worksheet/test_data_bar_04.rb +145 -0
- data/test/worksheet/test_data_bar_05.rb +147 -0
- data/test/worksheet/test_data_bar_06.rb +145 -0
- data/test/worksheet/test_data_bar_07.rb +146 -0
- data/test/worksheet/test_data_bar_08.rb +54 -0
- data/test/worksheet/test_data_bar_09.rb +80 -0
- data/test/worksheet/test_data_bar_10.rb +165 -0
- data/test/worksheet/test_data_bar_11.rb +167 -0
- data/test/worksheet/test_data_bar_12.rb +104 -0
- data/test/worksheet/test_write_data_validation_02.rb +44 -0
- data/test/worksheet/test_write_hyperlink.rb +0 -7
- data/test/worksheet/test_write_sheet_view.rb +19 -1
- metadata +308 -5
- data/test/package/comments/test_write_text_t.rb +0 -44
@@ -0,0 +1,44 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionObjectPosition04 < Minitest::Test
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
@tempfile.close(true)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_object_position04
|
14
|
+
@xlsx = 'object_position04.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@io)
|
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, [59106432, 60702720])
|
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
|
+
worksheet.insert_chart(
|
35
|
+
'E9', chart,
|
36
|
+
:x_offset => 0, :y_offset => 0,
|
37
|
+
:x_scale => 1, :y_scale => 1,
|
38
|
+
:object_position => 2
|
39
|
+
)
|
40
|
+
|
41
|
+
workbook.close
|
42
|
+
compare_for_regression
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionObjectPosition06 < Minitest::Test
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
@tempfile.close(true)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_object_position06
|
14
|
+
@xlsx = 'object_position06.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@io)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
|
18
|
+
worksheet.insert_image(
|
19
|
+
'E9', 'test/regression/images/red.png',
|
20
|
+
0, 0, 1, 1, 4
|
21
|
+
)
|
22
|
+
|
23
|
+
worksheet.set_row(8, nil, nil, 1)
|
24
|
+
|
25
|
+
workbook.close
|
26
|
+
compare_for_regression
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionObjectPosition07 < Minitest::Test
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
@tempfile.close(true)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_object_position07
|
14
|
+
@xlsx = 'object_position07.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@io)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
|
18
|
+
worksheet.insert_image(
|
19
|
+
'E9', 'test/regression/images/red.png',
|
20
|
+
0, 0, 1, 1, 4
|
21
|
+
)
|
22
|
+
|
23
|
+
worksheet.set_row(8, 30, nil, 1)
|
24
|
+
|
25
|
+
workbook.close
|
26
|
+
compare_for_regression
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionObjectPosition08 < Minitest::Test
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
@tempfile.close(true)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_object_position08
|
14
|
+
@xlsx = 'object_position08.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@io)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
chart = workbook.add_chart(:type => 'line', :embedded => 1)
|
18
|
+
|
19
|
+
bold = workbook.add_format(:bold => 1)
|
20
|
+
italic = workbook.add_format(:italic => 1)
|
21
|
+
|
22
|
+
# For testing, copy the randomly generated axis ids in the target xlsx file.
|
23
|
+
chart.instance_variable_set(:@axis_ids, [60888960, 79670656])
|
24
|
+
|
25
|
+
data = [
|
26
|
+
[1, 2, 3, 4, 5],
|
27
|
+
[2, 4, 6, 8, 10],
|
28
|
+
[3, 6, 9, 12, 15]
|
29
|
+
]
|
30
|
+
|
31
|
+
worksheet.write('A1', 'Foo', bold)
|
32
|
+
worksheet.write('B1', 'Bar', italic)
|
33
|
+
worksheet.write('A2', data)
|
34
|
+
|
35
|
+
worksheet.set_row(12, nil, nil, 1)
|
36
|
+
worksheet.set_column('F:F', nil, nil, 1)
|
37
|
+
|
38
|
+
chart.add_series(:values => '=Sheet1!$A$2:$A$6')
|
39
|
+
chart.add_series(:values => '=Sheet1!$B$2:$B$6')
|
40
|
+
chart.add_series(:values => '=Sheet1!$C$2:$C$6')
|
41
|
+
|
42
|
+
worksheet.insert_chart('E9', chart, 0, 0, 1, 1, 2)
|
43
|
+
|
44
|
+
workbook.close
|
45
|
+
compare_for_regression
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionObjectPosition09 < Minitest::Test
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
@tempfile.close(true)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_object_position09
|
14
|
+
@xlsx = 'object_position09.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@io)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
chart = workbook.add_chart(:type => 'line', :embedded => 1)
|
18
|
+
|
19
|
+
bold = workbook.add_format(:bold => 1)
|
20
|
+
italic = workbook.add_format(:italic => 1)
|
21
|
+
|
22
|
+
# For testing, copy the randomly generated axis ids in the target xlsx file.
|
23
|
+
chart.instance_variable_set(:@axis_ids, [60910208, 69231360])
|
24
|
+
|
25
|
+
data = [
|
26
|
+
[1, 2, 3, 4, 5],
|
27
|
+
[2, 4, 6, 8, 10],
|
28
|
+
[3, 6, 9, 12, 15]
|
29
|
+
]
|
30
|
+
|
31
|
+
worksheet.write('A1', 'Foo', bold)
|
32
|
+
worksheet.write('B1', 'Bar', italic)
|
33
|
+
worksheet.write('A2', data)
|
34
|
+
|
35
|
+
worksheet.set_row(12, nil, nil, 1)
|
36
|
+
worksheet.set_column('F:F', 9, nil, 1)
|
37
|
+
|
38
|
+
chart.add_series(:values => '=Sheet1!$A$2:$A$6')
|
39
|
+
chart.add_series(:values => '=Sheet1!$B$2:$B$6')
|
40
|
+
chart.add_series(:values => '=Sheet1!$C$2:$C$6')
|
41
|
+
|
42
|
+
worksheet.insert_chart(
|
43
|
+
'E9', chart,
|
44
|
+
:object_position => 4
|
45
|
+
)
|
46
|
+
|
47
|
+
workbook.close
|
48
|
+
compare_for_regression
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionObjectPosition10 < Minitest::Test
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
@tempfile.close(true)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_object_position10
|
14
|
+
@xlsx = 'object_position10.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@io)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
|
18
|
+
worksheet.insert_image(
|
19
|
+
'E9', 'test/regression/images/red.png',
|
20
|
+
0, 0, 1, 1, 4
|
21
|
+
)
|
22
|
+
|
23
|
+
worksheet.set_column('E:E', nil, nil, 1)
|
24
|
+
|
25
|
+
workbook.close
|
26
|
+
compare_for_regression
|
27
|
+
end
|
28
|
+
end
|
@@ -31,9 +31,6 @@ def test_properties01
|
|
31
31
|
worksheet.write('A1', "Select 'Office Button -> Prepare -> Properties' to see the file properties.")
|
32
32
|
|
33
33
|
workbook.close
|
34
|
-
compare_for_regression
|
35
|
-
nil,
|
36
|
-
{ 'xl/workbook.xml' => ['<workbookView'] }
|
37
|
-
)
|
34
|
+
compare_for_regression
|
38
35
|
end
|
39
36
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionProperties03 < Minitest::Test
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
@tempfile.close(true)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_properties03
|
14
|
+
@xlsx = 'properties03.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@io)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
|
18
|
+
workbook.set_custom_property('Checked by', 'Adam')
|
19
|
+
|
20
|
+
worksheet.set_column('A:A', 70)
|
21
|
+
worksheet.write('A1', "Select 'Office Button -> Prepare -> Properties' to see the file properties.")
|
22
|
+
|
23
|
+
workbook.close
|
24
|
+
compare_for_regression
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionProperties04 < Minitest::Test
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
@long_string = 'This is a long string. ' * 11 + 'AA'
|
8
|
+
end
|
9
|
+
|
10
|
+
def teardown
|
11
|
+
@tempfile.close(true)
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_properties04
|
15
|
+
@xlsx = 'properties04.xlsx'
|
16
|
+
workbook = WriteXLSX.new(@io)
|
17
|
+
worksheet = workbook.add_worksheet
|
18
|
+
|
19
|
+
workbook.set_custom_property('Checked by', 'Adam', 'text' )
|
20
|
+
workbook.set_custom_property('Date completed', '2016-12-12T23:00:00Z', 'date' )
|
21
|
+
workbook.set_custom_property('Document number', '12345' , 'number_int')
|
22
|
+
workbook.set_custom_property('Reference', '1.2345', 'number' )
|
23
|
+
workbook.set_custom_property('Source', true, 'bool' )
|
24
|
+
workbook.set_custom_property('Status', false, 'bool' )
|
25
|
+
workbook.set_custom_property('Department', @long_string, 'text' )
|
26
|
+
workbook.set_custom_property('Group', '1.2345678901234', 'number' )
|
27
|
+
|
28
|
+
worksheet.set_column('A:A', 70 )
|
29
|
+
worksheet.write(
|
30
|
+
'A1',
|
31
|
+
"Select 'Office Button -> Prepare -> Properties' to see the file properties."
|
32
|
+
)
|
33
|
+
|
34
|
+
workbook.close
|
35
|
+
compare_for_regression
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_properties04_2
|
39
|
+
@xlsx = 'properties04.xlsx'
|
40
|
+
workbook = WriteXLSX.new(@io)
|
41
|
+
worksheet = workbook.add_worksheet
|
42
|
+
|
43
|
+
workbook.set_custom_property('Checked by', 'Adam' )
|
44
|
+
workbook.set_custom_property('Date completed', '2016-12-12T23:00:00Z', 'date' )
|
45
|
+
workbook.set_custom_property('Document number', '12345' )
|
46
|
+
workbook.set_custom_property('Reference', '1.2345' )
|
47
|
+
workbook.set_custom_property('Source', 1, 'bool' )
|
48
|
+
workbook.set_custom_property('Status', nil, 'bool' )
|
49
|
+
workbook.set_custom_property('Department', @long_string )
|
50
|
+
workbook.set_custom_property('Group', '1.2345678901234' )
|
51
|
+
|
52
|
+
worksheet.set_column('A:A', 70 )
|
53
|
+
worksheet.write(
|
54
|
+
'A1',
|
55
|
+
"Select 'Office Button -> Prepare -> Properties' to see the file properties."
|
56
|
+
)
|
57
|
+
|
58
|
+
workbook.close
|
59
|
+
compare_for_regression
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionProperties05 < Minitest::Test
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
@long_string = 'This is a long string. ' * 11 + 'AA'
|
8
|
+
end
|
9
|
+
|
10
|
+
def teardown
|
11
|
+
@tempfile.close(true)
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_properties05
|
15
|
+
@xlsx = 'properties05.xlsx'
|
16
|
+
workbook = WriteXLSX.new(@io)
|
17
|
+
worksheet = workbook.add_worksheet
|
18
|
+
|
19
|
+
workbook.set_custom_property('Location', 'Café')
|
20
|
+
|
21
|
+
worksheet.set_column('A:A', 70 )
|
22
|
+
worksheet.write(
|
23
|
+
'A1',
|
24
|
+
"Select 'Office Button -> Prepare -> Properties' to see the file properties."
|
25
|
+
)
|
26
|
+
|
27
|
+
workbook.close
|
28
|
+
compare_for_regression
|
29
|
+
end
|
30
|
+
end
|
@@ -17,8 +17,10 @@ def test_shape_connect01
|
|
17
17
|
format = workbook.add_format(:font => 'Arial', :size => 8)
|
18
18
|
|
19
19
|
# Add a circle, with centered text
|
20
|
-
ellipse = workbook.add_shape(
|
21
|
-
|
20
|
+
ellipse = workbook.add_shape(
|
21
|
+
:type => 'ellipse', :text => "Hello\nWorld",
|
22
|
+
:width => 60, :height => 60, :format => format
|
23
|
+
)
|
22
24
|
worksheet.insert_shape('A1', ellipse, 50, 50)
|
23
25
|
|
24
26
|
# Add a plus
|
@@ -21,6 +21,9 @@ def test_table03
|
|
21
21
|
# Add the table.
|
22
22
|
worksheet.add_table('C3:F13')
|
23
23
|
|
24
|
+
# Turn off default URL format for testing.
|
25
|
+
worksheet.instance_variable_set(:@default_url_format, nil)
|
26
|
+
|
24
27
|
# Add a link to check rId handling.
|
25
28
|
worksheet.write('A1', 'http://perl.com/')
|
26
29
|
|
@@ -21,6 +21,9 @@ def test_table04
|
|
21
21
|
# Add the table.
|
22
22
|
worksheet.add_table('C3:F13')
|
23
23
|
|
24
|
+
# Turn off default URL format for testing.
|
25
|
+
worksheet.instance_variable_set(:@default_url_format, nil)
|
26
|
+
|
24
27
|
# Add a link to check rId handling.
|
25
28
|
worksheet.write('A1', 'http://perl.com/')
|
26
29
|
|
@@ -21,6 +21,9 @@ def test_table05
|
|
21
21
|
# Add the table.
|
22
22
|
worksheet.add_table('C3:F13')
|
23
23
|
|
24
|
+
# Turn off default URL format for testing.
|
25
|
+
worksheet.instance_variable_set(:@default_url_format, nil)
|
26
|
+
|
24
27
|
# Add a link to check rId handling.
|
25
28
|
worksheet.write('A1', 'http://perl.com/')
|
26
29
|
|
@@ -23,6 +23,9 @@ def test_table06
|
|
23
23
|
worksheet.add_table('F15:H20')
|
24
24
|
worksheet.add_table('C23:D30')
|
25
25
|
|
26
|
+
# Turn off default URL format for testing.
|
27
|
+
worksheet.instance_variable_set(:@default_url_format, nil)
|
28
|
+
|
26
29
|
# Add a link to check rId handling.
|
27
30
|
worksheet.write('A1', 'http://perl.com/')
|
28
31
|
worksheet.write('C1', 'http://perl.com/')
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionTable20 < Minitest::Test
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
@tempfile.close(true) if @tempfile
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_table20
|
14
|
+
@xlsx = 'table01.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@io)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
|
18
|
+
# Set the column width to match the taget worksheet.
|
19
|
+
worksheet.set_column('C:F', 10.288)
|
20
|
+
|
21
|
+
# Add the table.
|
22
|
+
worksheet.add_table('C3:F13')
|
23
|
+
|
24
|
+
e = assert_raises RuntimeError do
|
25
|
+
worksheet.add_table(
|
26
|
+
'C3:F7',
|
27
|
+
:columns => [ { :header => 'Column1' }, { :header => 'column1' }]
|
28
|
+
)
|
29
|
+
end
|
30
|
+
assert_match(/add_table\(\) contains duplicate name:/, e.message)
|
31
|
+
|
32
|
+
workbook.close
|
33
|
+
end
|
34
|
+
end
|