xlsxwriter 0.2.1.pre → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +4 -3
- data/ext/xlsxwriter/chart.c +88 -80
- data/ext/xlsxwriter/chart.h +2 -2
- data/ext/xlsxwriter/chartsheet.c +307 -0
- data/ext/xlsxwriter/chartsheet.h +15 -0
- data/ext/xlsxwriter/common.h +104 -0
- data/ext/xlsxwriter/extconf.rb +8 -8
- data/ext/xlsxwriter/libxlsxwriter/License.txt +24 -2
- data/ext/xlsxwriter/libxlsxwriter/Makefile +46 -12
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/app.h +1 -1
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/chart.h +196 -30
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/chartsheet.h +3 -3
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/comment.h +76 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/common.h +24 -5
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/content_types.h +5 -1
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/core.h +1 -1
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/custom.h +1 -1
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/drawing.h +6 -17
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/format.h +20 -6
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/hash_table.h +1 -1
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/packager.h +3 -1
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/relationships.h +1 -1
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/shared_strings.h +1 -1
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/styles.h +11 -5
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/theme.h +1 -1
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/third_party/md5.h +43 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/utility.h +42 -3
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/vml.h +55 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/workbook.h +83 -18
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/worksheet.h +1519 -109
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/xmlwriter.h +4 -2
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter.h +3 -2
- data/ext/xlsxwriter/libxlsxwriter/src/Makefile +25 -7
- data/ext/xlsxwriter/libxlsxwriter/src/app.c +1 -1
- data/ext/xlsxwriter/libxlsxwriter/src/chart.c +332 -48
- data/ext/xlsxwriter/libxlsxwriter/src/chartsheet.c +20 -19
- data/ext/xlsxwriter/libxlsxwriter/src/comment.c +443 -0
- data/ext/xlsxwriter/libxlsxwriter/src/content_types.c +20 -1
- data/ext/xlsxwriter/libxlsxwriter/src/core.c +2 -2
- data/ext/xlsxwriter/libxlsxwriter/src/custom.c +1 -1
- data/ext/xlsxwriter/libxlsxwriter/src/drawing.c +58 -20
- data/ext/xlsxwriter/libxlsxwriter/src/format.c +98 -25
- data/ext/xlsxwriter/libxlsxwriter/src/hash_table.c +1 -1
- data/ext/xlsxwriter/libxlsxwriter/src/packager.c +269 -12
- data/ext/xlsxwriter/libxlsxwriter/src/relationships.c +1 -1
- data/ext/xlsxwriter/libxlsxwriter/src/shared_strings.c +2 -4
- data/ext/xlsxwriter/libxlsxwriter/src/styles.c +334 -48
- data/ext/xlsxwriter/libxlsxwriter/src/theme.c +1 -1
- data/ext/xlsxwriter/libxlsxwriter/src/utility.c +71 -8
- data/ext/xlsxwriter/libxlsxwriter/src/vml.c +1032 -0
- data/ext/xlsxwriter/libxlsxwriter/src/workbook.c +343 -27
- data/ext/xlsxwriter/libxlsxwriter/src/worksheet.c +3759 -478
- data/ext/xlsxwriter/libxlsxwriter/src/xmlwriter.c +81 -2
- data/ext/xlsxwriter/libxlsxwriter/third_party/md5/Makefile +42 -0
- data/ext/xlsxwriter/libxlsxwriter/third_party/md5/md5.c +291 -0
- data/ext/xlsxwriter/libxlsxwriter/third_party/md5/md5.h +43 -0
- data/ext/xlsxwriter/shared_strings.c +65 -0
- data/ext/xlsxwriter/shared_strings.h +15 -0
- data/ext/xlsxwriter/workbook.c +96 -20
- data/ext/xlsxwriter/worksheet.c +125 -235
- data/ext/xlsxwriter/worksheet.h +2 -1
- data/ext/xlsxwriter/xlsxwriter.c +4 -0
- data/lib/xlsxwriter/rich_string.rb +0 -2
- data/lib/xlsxwriter/version.rb +1 -1
- data/lib/xlsxwriter/worksheet.rb +2 -2
- data/test/{run-test.rb → run_test.rb} +3 -3
- data/test/support/chart_test.rb +3 -3
- data/test/support/with_xlsx_file.rb +4 -2
- data/test/support/xlsx_comparable.rb +40 -26
- data/test/test_array_formula.rb +42 -0
- data/test/test_autofilter.rb +72 -0
- data/test/{test-chart-area.rb → test_chart_area.rb} +2 -2
- data/test/{test-chart-axis.rb → test_chart_axis.rb} +16 -16
- data/test/test_chart_bar.rb +382 -0
- data/test/test_chart_blank.rb +27 -0
- data/test/{test-chart-column.rb → test_chart_column.rb} +2 -2
- data/test/{test-chart-doughnut.rb → test_chart_doughnut.rb} +2 -2
- data/test/{test-chart-legend.rb → test_chart_legend.rb} +2 -2
- data/test/{test-chart-pie.rb → test_chart_pie.rb} +2 -2
- data/test/{test-chart-scatter.rb → test_chart_scatter.rb} +3 -4
- data/test/{test-chart-size.rb → test_chart_size.rb} +2 -2
- data/test/{test-chart-title.rb → test_chart_title.rb} +3 -3
- data/test/test_chartsheet.rb +201 -0
- data/test/{test-data.rb → test_data.rb} +1 -1
- data/test/{test-data-validation.rb → test_data_validation.rb} +23 -24
- data/test/{test-default-row.rb → test_default_row.rb} +1 -1
- data/test/{test-defined-name.rb → test_defined_name.rb} +12 -12
- data/test/{test-escapes.rb → test_escapes.rb} +5 -2
- data/test/{test-fit-to-pages.rb → test_fit_to_pages.rb} +6 -6
- data/test/{test-formatting.rb → test_formatting.rb} +10 -10
- data/test/{test-gridlines.rb → test_gridlines.rb} +3 -3
- data/test/{test-hyperlink.rb → test_hyperlink.rb} +22 -11
- data/test/{test-image.rb → test_image.rb} +6 -4
- data/test/{test-macro.rb → test_macro.rb} +1 -1
- data/test/{test-merge-range.rb → test_merge_range.rb} +1 -1
- data/test/{test-misc.rb → test_misc.rb} +2 -2
- data/test/{test-optimize.rb → test_optimize.rb} +2 -4
- data/test/{test-outline.rb → test_outline.rb} +14 -14
- data/test/{test-page-breaks.rb → test_page_breaks.rb} +2 -2
- data/test/{test-page-setup.rb → test_page_setup.rb} +2 -2
- data/test/{test-panes.rb → test_panes.rb} +1 -1
- data/test/{test-print-area.rb → test_print_area.rb} +3 -3
- data/test/{test-print-options.rb → test_print_options.rb} +7 -7
- data/test/{test-print-scale.rb → test_print_scale.rb} +2 -2
- data/test/{test-properties.rb → test_properties.rb} +2 -2
- data/test/{test-protect.rb → test_protect.rb} +3 -3
- data/test/{test-repeat.rb → test_repeat.rb} +3 -3
- data/test/{test-rich-string.rb → test_rich_string.rb} +5 -9
- data/test/{test-row-col-format.rb → test_row_col_format.rb} +1 -1
- data/test/{test-ruby-worksheet.rb → test_ruby_worksheet.rb} +2 -2
- data/test/{test-set-selection.rb → test_set_selection.rb} +2 -2
- data/test/{test-set-start-page.rb → test_set_start_page.rb} +2 -2
- data/test/{test-simple.rb → test_simple.rb} +10 -10
- data/test/{test-types.rb → test_types.rb} +1 -1
- data/test/{xlsx-func-testcase.rb → xlsx_func_testcase.rb} +1 -0
- metadata +135 -104
- data/test/test-array-formula.rb +0 -35
- data/test/test-autofilter.rb +0 -72
- data/test/test-chart-bar.rb +0 -74
- /data/test/{test-errors.rb → test_errors.rb} +0 -0
data/ext/xlsxwriter/worksheet.h
CHANGED
@@ -12,10 +12,11 @@ lxw_col_t value_to_col(VALUE value);
|
|
12
12
|
int extract_cell(int argc, VALUE *argv, lxw_row_t *row, lxw_col_t *col);
|
13
13
|
int extract_range(int argc, VALUE *argv, lxw_row_t *row1, lxw_col_t *col1,
|
14
14
|
lxw_row_t *row2, lxw_col_t *col2);
|
15
|
+
lxw_chart_options val_to_lxw_chart_options(VALUE opts, char *with_options);
|
15
16
|
lxw_image_options val_to_lxw_image_options(VALUE opts, char *with_options);
|
16
17
|
|
17
18
|
void init_xlsxwriter_worksheet();
|
18
19
|
|
19
20
|
extern VALUE cWorksheet;
|
20
21
|
|
21
|
-
#endif
|
22
|
+
#endif // __WORKSHEET__
|
data/ext/xlsxwriter/xlsxwriter.c
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
#include <ruby.h>
|
2
2
|
#include <xlsxwriter.h>
|
3
3
|
#include "chart.h"
|
4
|
+
#include "chartsheet.h"
|
4
5
|
#include "format.h"
|
5
6
|
#include "rich_string.h"
|
7
|
+
#include "shared_strings.h"
|
6
8
|
#include "workbook.h"
|
7
9
|
#include "workbook_properties.h"
|
8
10
|
#include "worksheet.h"
|
@@ -41,5 +43,7 @@ void Init_xlsxwriter() {
|
|
41
43
|
init_xlsxwriter_format();
|
42
44
|
init_xlsxwriter_worksheet();
|
43
45
|
init_xlsxwriter_chart();
|
46
|
+
init_xlsxwriter_chartsheet();
|
44
47
|
init_xlsxwriter_rich_string();
|
48
|
+
init_xlsxwriter_shared_strings_table();
|
45
49
|
}
|
data/lib/xlsxwriter/version.rb
CHANGED
data/lib/xlsxwriter/worksheet.rb
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module XlsxWriter
|
4
|
-
|
5
4
|
class Worksheet
|
6
5
|
# Last row number written with #add_row
|
7
6
|
attr_reader :current_row, :col_auto_widths
|
8
7
|
|
9
8
|
# Thiner characters list used for column width logic mimicking axlsx behaviour
|
10
|
-
THIN_CHARS = '^.acfijklrstxzFIJL()-'
|
9
|
+
THIN_CHARS = '^.acfijklrstxzFIJL()-'
|
11
10
|
|
12
11
|
# Write a +row+. If no +types+ passed XlsxWriter tries to deduce them automatically.
|
13
12
|
#
|
@@ -51,6 +50,7 @@ module XlsxWriter
|
|
51
50
|
write_blank(row_idx, idx, cell_style)
|
52
51
|
when :skip, :empty
|
53
52
|
# write nothing
|
53
|
+
nil
|
54
54
|
when nil
|
55
55
|
case value
|
56
56
|
when Numeric
|
@@ -1,9 +1,9 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
base_dir = File.expand_path(
|
5
|
-
lib_dir = File.join(base_dir,
|
6
|
-
test_dir = File.join(base_dir,
|
4
|
+
base_dir = File.expand_path('..', __dir__)
|
5
|
+
lib_dir = File.join(base_dir, 'lib')
|
6
|
+
test_dir = File.join(base_dir, 'test')
|
7
7
|
|
8
8
|
$LOAD_PATH.unshift(lib_dir)
|
9
9
|
|
data/test/support/chart_test.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module ChartTest
|
4
|
-
def chart_test(fname, type, data = self::DATA, &
|
5
|
-
test fname do |wb|
|
4
|
+
def chart_test(fname, type, data = self::DATA, ref_file_name: nil, &_block)
|
5
|
+
test fname, ref_file_name: ref_file_name do |wb|
|
6
6
|
wb.add_worksheet do |ws|
|
7
7
|
data.each { |row| ws.add_row row }
|
8
8
|
|
9
9
|
wb.add_chart(type) do |chart|
|
10
|
-
yield chart
|
10
|
+
yield chart, ws
|
11
11
|
|
12
12
|
ws.insert_chart 'E9', chart
|
13
13
|
end
|
@@ -1,10 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'xlsxwriter'
|
2
4
|
|
3
5
|
module WithXlsxFile
|
4
|
-
def with_xlsx_file(file_path = 'tmp/test.xlsx', **opts)
|
6
|
+
def with_xlsx_file(file_path = 'tmp/test.xlsx', **opts, &block)
|
5
7
|
after = opts.delete :after
|
6
8
|
XlsxWriter::Workbook.open(file_path, opts) do |wb|
|
7
|
-
|
9
|
+
block.call(wb)
|
8
10
|
end
|
9
11
|
after.call if after
|
10
12
|
ensure
|
@@ -1,9 +1,18 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'diffy'
|
3
4
|
require 'test/unit'
|
4
5
|
require 'zip'
|
5
6
|
|
6
7
|
module XlsxComparable
|
8
|
+
def assert_long_seq_equal(expected, actual)
|
9
|
+
expected = expected.join("\n")
|
10
|
+
actual = actual.join("\n")
|
11
|
+
diff = Diffy::Diff.new(expected, actual).to_s(:color)
|
12
|
+
full_message = "diff: \n#{diff}"
|
13
|
+
assert_block(full_message) { expected == actual }
|
14
|
+
end
|
15
|
+
|
7
16
|
def assert_xlsx_equal(got_path, exp_path, ignore_files = [], ignore_elements = {})
|
8
17
|
Zip::File.open(exp_path) do |exp_zip|
|
9
18
|
Zip::File.open(got_path) do |got_zip|
|
@@ -17,38 +26,22 @@ module XlsxComparable
|
|
17
26
|
exp_xml_str = exp_zip.read(exp_entry.name)
|
18
27
|
got_xml_str = got_zip.read(exp_entry.name)
|
19
28
|
|
20
|
-
if %w
|
29
|
+
if %w[.png .jpeg .bmp .bin].include?(File.extname(exp_entry.name))
|
21
30
|
exp_xml_str.force_encoding('BINARY')
|
22
31
|
assert_equal(exp_xml_str, got_xml_str)
|
23
32
|
next
|
24
33
|
end
|
25
34
|
|
26
|
-
|
27
|
-
when 'docProps/core.xml'
|
28
|
-
exp_xml_str.gsub!(/ ?John/, '')
|
29
|
-
exp_xml_str.gsub!(/\d{4}-\d\d-\d\dT\d\d\:\d\d:\d\dZ/, '')
|
30
|
-
got_xml_str.gsub!(/\d{4}-\d\d-\d\dT\d\d\:\d\d:\d\dZ/, '')
|
31
|
-
when 'xl/workbook.xml'
|
32
|
-
exp_xml_str.gsub!(/<workbookView[^>]*>/, '<workbookView/>')
|
33
|
-
exp_xml_str.gsub!(/<calcPr[^>]*>/, '<calcPr/>')
|
34
|
-
got_xml_str.gsub!(/<workbookView[^>]*>/, '<workbookView/>')
|
35
|
-
got_xml_str.gsub!(/<calcPr[^>]*>/, '<calcPr/>')
|
36
|
-
when %r{xl/worksheets/sheet\d+.xml}
|
37
|
-
exp_xml_str.gsub!(/horizontalDpi="200" /, '')
|
38
|
-
exp_xml_str.gsub!(/verticalDpi="200" /, '')
|
39
|
-
exp_xml_str.gsub!(/(<pageSetup[^>]*) r:id="rId1"/, '\1')
|
40
|
-
when %r{xl/charts/chart\d+.xml}
|
41
|
-
exp_xml_str.gsub!(/<c:pageMargins[^>]*>/, '<c:pageMargins/>')
|
42
|
-
got_xml_str.gsub!(/<c:pageMargins[^>]*>/, '<c:pageMargins/>')
|
43
|
-
end
|
35
|
+
_sanitize_for_comparison(exp_entry.name, exp_xml_str, got_xml_str)
|
44
36
|
|
45
37
|
got_xml = _xml_to_list(got_xml_str)
|
46
38
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
39
|
+
exp_xml =
|
40
|
+
if exp_entry.name =~ /.vml\z/
|
41
|
+
_vml_to_list(exp_xml_str)
|
42
|
+
else
|
43
|
+
_xml_to_list(exp_xml_str)
|
44
|
+
end
|
52
45
|
|
53
46
|
if ignore_elements.key?(exp_entry.name)
|
54
47
|
patterns = ignore_elements[exp_entry.name]
|
@@ -61,7 +54,7 @@ module XlsxComparable
|
|
61
54
|
exp_xml = _sort_rel_file_data(exp_xml)
|
62
55
|
end
|
63
56
|
|
64
|
-
|
57
|
+
assert_long_seq_equal exp_xml, got_xml
|
65
58
|
end
|
66
59
|
end
|
67
60
|
end
|
@@ -86,7 +79,7 @@ module XlsxComparable
|
|
86
79
|
line.strip!
|
87
80
|
next if line == ''
|
88
81
|
|
89
|
-
line.tr!(
|
82
|
+
line.tr!("'", '"')
|
90
83
|
line << ' ' if line =~ /"$/
|
91
84
|
line << "\n" if line =~ />$/
|
92
85
|
line.gsub!('><', ">\n<")
|
@@ -107,4 +100,25 @@ module XlsxComparable
|
|
107
100
|
|
108
101
|
xml_elements
|
109
102
|
end
|
103
|
+
|
104
|
+
def _sanitize_for_comparison(name, exp_xml_str, got_xml_str)
|
105
|
+
case name
|
106
|
+
when 'docProps/core.xml'
|
107
|
+
exp_xml_str.gsub!(/ ?John/, '')
|
108
|
+
exp_xml_str.gsub!(/\d{4}-\d\d-\d\dT\d\d:\d\d:\d\dZ/, '')
|
109
|
+
got_xml_str.gsub!(/\d{4}-\d\d-\d\dT\d\d:\d\d:\d\dZ/, '')
|
110
|
+
when 'xl/workbook.xml'
|
111
|
+
exp_xml_str.gsub!(/<workbookView[^>]*>/, '<workbookView/>')
|
112
|
+
exp_xml_str.gsub!(/<calcPr[^>]*>/, '<calcPr/>')
|
113
|
+
got_xml_str.gsub!(/<workbookView[^>]*>/, '<workbookView/>')
|
114
|
+
got_xml_str.gsub!(/<calcPr[^>]*>/, '<calcPr/>')
|
115
|
+
when %r{xl/worksheets/sheet\d+.xml}
|
116
|
+
exp_xml_str.gsub!(/horizontalDpi="200" /, '')
|
117
|
+
exp_xml_str.gsub!(/verticalDpi="200" /, '')
|
118
|
+
exp_xml_str.gsub!(/(<pageSetup[^>]*) r:id="rId1"/, '\1')
|
119
|
+
when %r{xl/charts/chart\d+.xml}
|
120
|
+
exp_xml_str.gsub!(/<c:pageMargins[^>]*>/, '<c:pageMargins/>')
|
121
|
+
got_xml_str.gsub!(/<c:pageMargins[^>]*>/, '<c:pageMargins/>')
|
122
|
+
end
|
123
|
+
end
|
110
124
|
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative './xlsx_func_testcase'
|
4
|
+
|
5
|
+
class TestArrayFormula < XlsxWriterTestCase
|
6
|
+
test 'array_formula01' do |wb, t|
|
7
|
+
t.ignore_files = %w(
|
8
|
+
xl/calcChain.xml
|
9
|
+
[Content_Types].xml
|
10
|
+
xl/_rels/workbook.xml.rels
|
11
|
+
)
|
12
|
+
ws = wb.add_worksheet nil
|
13
|
+
|
14
|
+
ws.write_number(0, 1, 0, nil)
|
15
|
+
ws.write_number(1, 1, 0, nil)
|
16
|
+
ws.write_number(2, 1, 0, nil)
|
17
|
+
ws.write_number(0, 2, 0, nil)
|
18
|
+
ws.write_number(1, 2, 0, nil)
|
19
|
+
ws.write_number(2, 2, 0, nil)
|
20
|
+
|
21
|
+
ws.write_array_formula(0, 0, 2, 0, '{=SUM(B1:C1*B2:C2)}', nil)
|
22
|
+
end
|
23
|
+
|
24
|
+
test 'array_formula02' do |wb, t|
|
25
|
+
t.ignore_files = %w(
|
26
|
+
xl/calcChain.xml
|
27
|
+
[Content_Types].xml
|
28
|
+
xl/_rels/workbook.xml.rels
|
29
|
+
)
|
30
|
+
ws = wb.add_worksheet
|
31
|
+
wb.add_format(:bold, bold: true)
|
32
|
+
|
33
|
+
ws.write_number(0, 1, 0, nil)
|
34
|
+
ws.write_number(1, 1, 0, nil)
|
35
|
+
ws.write_number(2, 1, 0, nil)
|
36
|
+
ws.write_number(0, 2, 0, nil)
|
37
|
+
ws.write_number(1, 2, 0, nil)
|
38
|
+
ws.write_number(2, 2, 0, nil)
|
39
|
+
|
40
|
+
ws.write_array_formula(0, 0, 2, 0, '{=SUM(B1:C1*B2:C2)}', :bold)
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative './xlsx_func_testcase'
|
4
|
+
|
5
|
+
class TestAutofilter < XlsxWriterTestCase
|
6
|
+
ROWS = [
|
7
|
+
%w[Region Item Volume Month],
|
8
|
+
['East', 'Apple', 9000, 'July'],
|
9
|
+
['East', 'Apple', 5000, 'July'],
|
10
|
+
['South', 'Orange', 9000, 'September'],
|
11
|
+
['North', 'Apple', 2000, 'November'],
|
12
|
+
['West', 'Apple', 9000, 'November'],
|
13
|
+
['South', 'Pear', 7000, 'October'],
|
14
|
+
['North', 'Pear', 9000, 'August'],
|
15
|
+
['West', 'Orange', 1000, 'December'],
|
16
|
+
['West', 'Grape', 1000, 'November'],
|
17
|
+
['South', 'Pear', 10_000, 'April'],
|
18
|
+
['West', 'Grape', 6000, 'January'],
|
19
|
+
['South', 'Orange', 3000, 'May'],
|
20
|
+
['North', 'Apple', 3000, 'December'],
|
21
|
+
['South', 'Apple', 7000, 'February'],
|
22
|
+
['West', 'Grape', 1000, 'December'],
|
23
|
+
['East', 'Grape', 8000, 'February'],
|
24
|
+
['South', 'Grape', 10_000, 'June'],
|
25
|
+
['West', 'Pear', 7000, 'December'],
|
26
|
+
['South', 'Apple', 2000, 'October'],
|
27
|
+
['East', 'Grape', 7000, 'December'],
|
28
|
+
['North', 'Grape', 6000, 'April'],
|
29
|
+
['East', 'Pear', 8000, 'February'],
|
30
|
+
['North', 'Apple', 7000, 'August'],
|
31
|
+
['North', 'Orange', 7000, 'July'],
|
32
|
+
['North', 'Apple', 6000, 'June'],
|
33
|
+
['South', 'Grape', 8000, 'September'],
|
34
|
+
['West', 'Apple', 3000, 'October'],
|
35
|
+
['South', 'Orange', 10_000, 'November'],
|
36
|
+
['West', 'Grape', 4000, 'July'],
|
37
|
+
['North', 'Orange', 5000, 'August'],
|
38
|
+
['East', 'Orange', 1000, 'November'],
|
39
|
+
['East', 'Orange', 4000, 'October'],
|
40
|
+
['North', 'Grape', 5000, 'August'],
|
41
|
+
['East', 'Apple', 1000, 'December'],
|
42
|
+
['South', 'Apple', 10_000, 'March'],
|
43
|
+
['East', 'Grape', 7000, 'October'],
|
44
|
+
['West', 'Grape', 1000, 'September'],
|
45
|
+
['East', 'Grape', 10_000, 'October'],
|
46
|
+
['South', 'Orange', 8000, 'March'],
|
47
|
+
['North', 'Apple', 4000, 'July'],
|
48
|
+
['South', 'Orange', 5000, 'July'],
|
49
|
+
['West', 'Apple', 4000, 'June'],
|
50
|
+
['East', 'Apple', 5000, 'April'],
|
51
|
+
['North', 'Pear', 3000, 'August'],
|
52
|
+
['East', 'Grape', 9000, 'November'],
|
53
|
+
['North', 'Orange', 8000, 'October'],
|
54
|
+
['East', 'Apple', 10_000, 'June'],
|
55
|
+
['South', 'Pear', 1000, 'December'],
|
56
|
+
['North', 'Grape', 10_000, 'July'],
|
57
|
+
['East', 'Grape', 6000, 'February']
|
58
|
+
].freeze
|
59
|
+
|
60
|
+
test 'autofilter00' do |wb|
|
61
|
+
ws = wb.add_worksheet
|
62
|
+
|
63
|
+
ROWS.each { |row| ws.add_row row }
|
64
|
+
end
|
65
|
+
|
66
|
+
test 'autofilter01' do |wb|
|
67
|
+
ws = wb.add_worksheet
|
68
|
+
|
69
|
+
ROWS.each { |row| ws.add_row row }
|
70
|
+
ws.autofilter('A1', 50, 3)
|
71
|
+
end
|
72
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative './
|
3
|
+
require_relative './xlsx_func_testcase'
|
4
4
|
|
5
5
|
class TestChartArea < XlsxWriterTestCase
|
6
6
|
DATA = [
|
@@ -9,7 +9,7 @@ class TestChartArea < XlsxWriterTestCase
|
|
9
9
|
[3, 6, 9],
|
10
10
|
[4, 8, 12],
|
11
11
|
[5, 10, 15]
|
12
|
-
]
|
12
|
+
].freeze
|
13
13
|
|
14
14
|
test 'chart_area01' do |wb|
|
15
15
|
wb.add_worksheet do |ws|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative './
|
3
|
+
require_relative './xlsx_func_testcase'
|
4
4
|
require_relative './support/chart_test'
|
5
5
|
|
6
6
|
class TestChartAxis < XlsxWriterTestCase
|
@@ -11,16 +11,16 @@ class TestChartAxis < XlsxWriterTestCase
|
|
11
11
|
[2, 4, 6],
|
12
12
|
[3, 6, 9],
|
13
13
|
[4, 8, 12],
|
14
|
-
[5, 10, 15]
|
15
|
-
]
|
14
|
+
[5, 10, 15]
|
15
|
+
].freeze
|
16
16
|
|
17
17
|
DATA2 = [
|
18
18
|
[1, 8, 3],
|
19
19
|
[2, 7, 6],
|
20
20
|
[3, 6, 9],
|
21
21
|
[4, 8, 12],
|
22
|
-
[5, 10, 15]
|
23
|
-
]
|
22
|
+
[5, 10, 15]
|
23
|
+
].freeze
|
24
24
|
|
25
25
|
chart_test 'chart_axis01', XlsxWriter::Workbook::Chart::BAR do |chart|
|
26
26
|
chart.axis_id_1 = 58_955_648
|
@@ -71,7 +71,7 @@ class TestChartAxis < XlsxWriterTestCase
|
|
71
71
|
|
72
72
|
test 'chart_axis06' do |wb|
|
73
73
|
wb.add_worksheet do |ws|
|
74
|
-
[
|
74
|
+
[[2, 60], [4, 30], [6, 10]].each { |row| ws.add_row row }
|
75
75
|
wb.add_chart(XlsxWriter::Workbook::Chart::PIE) do |chart|
|
76
76
|
chart.add_series '=Sheet1!$A$1:$A$3', '=Sheet1!$B$1:$B$3'
|
77
77
|
chart.title = 'Title'
|
@@ -279,8 +279,8 @@ class TestChartAxis < XlsxWriterTestCase
|
|
279
279
|
end
|
280
280
|
|
281
281
|
chart_test 'chart_axis26', XlsxWriter::Workbook::Chart::LINE do |chart|
|
282
|
-
chart.axis_id_1 =
|
283
|
-
chart.axis_id_2 =
|
282
|
+
chart.axis_id_1 = 108_315_392
|
283
|
+
chart.axis_id_2 = 108_329_216
|
284
284
|
|
285
285
|
chart.add_series '=Sheet1!$A$1:$A$5'
|
286
286
|
chart.add_series '=Sheet1!$B$1:$B$5'
|
@@ -290,8 +290,8 @@ class TestChartAxis < XlsxWriterTestCase
|
|
290
290
|
end
|
291
291
|
|
292
292
|
chart_test 'chart_axis27', XlsxWriter::Workbook::Chart::LINE do |chart|
|
293
|
-
chart.axis_id_1 =
|
294
|
-
chart.axis_id_2 =
|
293
|
+
chart.axis_id_1 = 108_315_392
|
294
|
+
chart.axis_id_2 = 108_329_216
|
295
295
|
|
296
296
|
chart.add_series '=Sheet1!$A$1:$A$5'
|
297
297
|
chart.add_series '=Sheet1!$B$1:$B$5'
|
@@ -301,8 +301,8 @@ class TestChartAxis < XlsxWriterTestCase
|
|
301
301
|
end
|
302
302
|
|
303
303
|
chart_test 'chart_axis28', XlsxWriter::Workbook::Chart::LINE do |chart|
|
304
|
-
chart.axis_id_1 =
|
305
|
-
chart.axis_id_2 =
|
304
|
+
chart.axis_id_1 = 115_375_104
|
305
|
+
chart.axis_id_2 = 115_390_720
|
306
306
|
|
307
307
|
chart.add_series '=Sheet1!$A$1:$A$5'
|
308
308
|
chart.add_series '=Sheet1!$B$1:$B$5'
|
@@ -312,8 +312,8 @@ class TestChartAxis < XlsxWriterTestCase
|
|
312
312
|
end
|
313
313
|
|
314
314
|
chart_test 'chart_axis29', XlsxWriter::Workbook::Chart::LINE do |chart|
|
315
|
-
chart.axis_id_1 =
|
316
|
-
chart.axis_id_2 =
|
315
|
+
chart.axis_id_1 = 145_169_024
|
316
|
+
chart.axis_id_2 = 145_176_448
|
317
317
|
|
318
318
|
chart.add_series '=Sheet1!$A$1:$A$5'
|
319
319
|
chart.add_series '=Sheet1!$B$1:$B$5'
|
@@ -356,8 +356,8 @@ class TestChartAxis < XlsxWriterTestCase
|
|
356
356
|
end
|
357
357
|
|
358
358
|
chart_test 'chart_axis33', XlsxWriter::Workbook::Chart::LINE do |chart|
|
359
|
-
chart.axis_id_1 =
|
360
|
-
chart.axis_id_2 =
|
359
|
+
chart.axis_id_1 = 143_682_944
|
360
|
+
chart.axis_id_2 = 143_946_496
|
361
361
|
|
362
362
|
chart.add_series '=Sheet1!$A$1:$A$5'
|
363
363
|
chart.add_series '=Sheet1!$B$1:$B$5'
|