axlsx 1.1.7 → 1.1.8
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +41 -5
- data/Rakefile +3 -2
- data/examples/chart_colors.rb +18 -3
- data/examples/example.rb +100 -46
- data/examples/extractive.pdf +0 -0
- data/lib/axlsx.rb +7 -6
- data/lib/axlsx/content_type/content_type.rb +2 -0
- data/lib/axlsx/content_type/default.rb +21 -12
- data/lib/axlsx/content_type/override.rb +22 -11
- data/lib/axlsx/doc_props/app.rb +36 -32
- data/lib/axlsx/doc_props/core.rb +9 -5
- data/lib/axlsx/drawing/ax_data_source.rb +7 -6
- data/lib/axlsx/drawing/axis.rb +48 -27
- data/lib/axlsx/drawing/bar_3D_chart.rb +47 -37
- data/lib/axlsx/drawing/bar_series.rb +1 -0
- data/lib/axlsx/drawing/cat_axis.rb +42 -38
- data/lib/axlsx/drawing/chart.rb +34 -27
- data/lib/axlsx/drawing/drawing.rb +5 -4
- data/lib/axlsx/drawing/line_3D_chart.rb +1 -1
- data/lib/axlsx/drawing/num_data_source.rb +1 -1
- data/lib/axlsx/drawing/pie_3D_chart.rb +7 -7
- data/lib/axlsx/drawing/two_cell_anchor.rb +3 -8
- data/lib/axlsx/drawing/view_3D.rb +41 -31
- data/lib/axlsx/drawing/vml_drawing.rb +1 -1
- data/lib/axlsx/package.rb +11 -11
- data/lib/axlsx/rels/relationship.rb +3 -3
- data/lib/axlsx/stylesheet/styles.rb +1 -1
- data/lib/axlsx/util/constants.rb +4 -0
- data/lib/axlsx/util/simple_typed_list.rb +2 -2
- data/lib/axlsx/util/validators.rb +2 -2
- data/lib/axlsx/version.rb +1 -1
- data/lib/axlsx/workbook/workbook.rb +1 -2
- data/lib/axlsx/workbook/worksheet/cell.rb +1 -1
- data/lib/axlsx/workbook/worksheet/data_bar.rb +1 -1
- data/lib/axlsx/workbook/worksheet/page_setup.rb +9 -0
- data/lib/axlsx/workbook/worksheet/protected_range.rb +46 -0
- data/lib/axlsx/workbook/worksheet/worksheet.rb +180 -56
- data/test/content_type/tc_content_type.rb +1 -6
- data/test/doc_props/tc_core.rb +1 -1
- data/test/drawing/tc_axis.rb +8 -0
- data/test/drawing/tc_bar_3D_chart.rb +12 -12
- data/test/drawing/tc_bar_series.rb +0 -1
- data/test/drawing/tc_chart.rb +1 -5
- data/test/drawing/tc_pie_3D_chart.rb +3 -7
- data/test/drawing/tc_view_3D.rb +18 -18
- data/test/tc_package.rb +2 -0
- data/test/workbook/worksheet/tc_page_setup.rb +20 -3
- data/test/workbook/worksheet/tc_protected_range.rb +18 -0
- data/test/workbook/worksheet/tc_selection.rb +1 -1
- data/test/workbook/worksheet/tc_worksheet.rb +39 -18
- metadata +54 -103
- data/examples/axis-titles.xlsx +0 -0
- data/examples/basic_charts.xlsx +0 -0
- data/examples/chart_colors.xlsx +0 -0
- data/examples/charts.xlsx +0 -0
- data/examples/conditional_formatting/getting_barred.xlsx +0 -0
- data/examples/doc/_index.html +0 -84
- data/examples/doc/class_list.html +0 -47
- data/examples/doc/css/common.css +0 -1
- data/examples/doc/css/full_list.css +0 -55
- data/examples/doc/css/style.css +0 -322
- data/examples/doc/file_list.html +0 -46
- data/examples/doc/frames.html +0 -13
- data/examples/doc/index.html +0 -84
- data/examples/doc/js/app.js +0 -205
- data/examples/doc/js/full_list.js +0 -173
- data/examples/doc/js/jquery.js +0 -16
- data/examples/doc/method_list.html +0 -46
- data/examples/doc/top-level-namespace.html +0 -95
- data/examples/example.xlsx +0 -0
- data/examples/example_streamed.xlsx +0 -0
- data/examples/examples_saved.xlsx +0 -0
- data/examples/extractive.xlsx +0 -0
- data/examples/fish.xlsx +0 -0
- data/examples/no-use_autowidth.xlsx +0 -0
- data/examples/pareto.rb +0 -28
- data/examples/pareto.xlsx +0 -0
- data/examples/pie_chart_excel.xlsx +0 -0
- data/examples/pie_chart_saved.xlsx +0 -0
- data/examples/shared_strings_example.xlsx +0 -0
- data/examples/sheet_protection.xlsx +0 -0
- data/examples/sheet_view.xlsx +0 -0
- data/examples/two_cell_anchor_image.xlsx +0 -0
- data/examples/~$example.xlsx +0 -0
- data/lib/axlsx/drawing/ax_data_source.rb~ +0 -55
- data/lib/axlsx/drawing/data_source.rb~ +0 -51
- data/lib/axlsx/drawing/hlink_click.rb~ +0 -0
- data/lib/axlsx/drawing/hyperlink.rb~ +0 -64
- data/lib/axlsx/drawing/num_data.rb~ +0 -51
- data/lib/axlsx/drawing/num_data_source.rb~ +0 -54
- data/lib/axlsx/drawing/num_val.rb~ +0 -40
- data/lib/axlsx/drawing/picture_locking.rb~ +0 -36
- data/lib/axlsx/drawing/ref.rb~ +0 -41
- data/lib/axlsx/drawing/str_data.rb~ +0 -58
- data/lib/axlsx/drawing/str_val.rb~ +0 -35
- data/lib/axlsx/drawing/vml_drawing.rb~ +0 -6
- data/lib/axlsx/drawing/vml_shape.rb~ +0 -61
- data/lib/axlsx/util/cbf.rb +0 -333
- data/lib/axlsx/util/cfb.rb~ +0 -201
- data/lib/axlsx/util/font_tables.rb~ +0 -0
- data/lib/axlsx/util/ms_off_crypto.rb +0 -189
- data/lib/axlsx/util/ms_off_crypto.rb~ +0 -3
- data/lib/axlsx/util/ms_offcrypto.rb~ +0 -0
- data/lib/axlsx/util/parser.rb~ +0 -6
- data/lib/axlsx/util/storage.rb~ +0 -0
- data/lib/axlsx/workbook/shared_strings_table.rb~ +0 -69
- data/lib/axlsx/workbook/worksheet/cfvo.rb~ +0 -0
- data/lib/axlsx/workbook/worksheet/col.rb~ +0 -0
- data/lib/axlsx/workbook/worksheet/color_scale.rb~ +0 -46
- data/lib/axlsx/workbook/worksheet/comment.rb~ +0 -91
- data/lib/axlsx/workbook/worksheet/comments.rb~ +0 -86
- data/lib/axlsx/workbook/worksheet/data_bar.rb~ +0 -0
- data/lib/axlsx/workbook/worksheet/icon_set.rb~ +0 -95
- data/lib/axlsx/workbook/worksheet/shared_strings_table.rb~ +0 -0
- data/lib/axlsx/workbook/worksheet/table.rb~ +0 -97
- data/lib/schema/dc.xsd~ +0 -118
- data/lib/schema/dcterms.xsd~ +0 -331
- data/lib/schema/opc-coreProperties.xsd~ +0 -50
- data/test/drawing/tc_data_source.rb~ +0 -30
- data/test/drawing/tc_num_data.rb~ +0 -35
- data/test/drawing/tc_num_val.rb~ +0 -29
- data/test/drawing/tc_str_data.rb~ +0 -30
- data/test/drawing/tc_str_val.rb~ +0 -26
- data/test/drawing/tc_vml_drawing.rb~ +0 -0
- data/test/workbook/worksheet/table/tc_table.rb~ +0 -72
- data/test/workbook/worksheet/tc_cfvo.rb~ +0 -20
- data/test/workbook/worksheet/tc_col.rb~ +0 -10
- data/test/workbook/worksheet/tc_color_scale.rb~ +0 -0
- data/test/workbook/worksheet/tc_data_bar.rb~ +0 -0
- data/test/workbook/worksheet/tc_icon_set.rb~ +0 -0
@@ -1,30 +0,0 @@
|
|
1
|
-
require 'tc_helper.rb'
|
2
|
-
|
3
|
-
class TestStrData < Test::Unit::TestCase
|
4
|
-
|
5
|
-
def setup
|
6
|
-
@str_data = Axlsx::StrData.new :data => ["1", "2", "3"]
|
7
|
-
end
|
8
|
-
|
9
|
-
def test_tag_name
|
10
|
-
assert_raise(ArgumentError) { @str_data.tag_name = :bob}
|
11
|
-
assert_nothing_raised { @str_data.tag_name = :strCache}
|
12
|
-
end
|
13
|
-
def test_initialize
|
14
|
-
assert_equal(@str_data.pt.size, 3)
|
15
|
-
assert(@str_data.pt.is_a? Axlsx::SimpleTypedList)
|
16
|
-
assert_equal(@str_data.tag_name, :strLit)
|
17
|
-
end
|
18
|
-
|
19
|
-
|
20
|
-
def test_to_xml_string_strLit
|
21
|
-
@str_data.tag_name = :strLit
|
22
|
-
str = '<?xml version="1.0" encoding="UTF-8"?>'
|
23
|
-
str << '<c:chartSpace xmlns:c="' << Axlsx::XML_NS_C << '">'
|
24
|
-
str << @str_data.to_xml_string(0)
|
25
|
-
doc = Nokogiri::XML(str)
|
26
|
-
assert_equal(doc.xpath("//c:strLit/c:ptCount[@val=3]").size, 1)
|
27
|
-
assert_equal(doc.xpath("//c:strLit/c:pt/c:v[text()='1']").size, 1)
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|
data/test/drawing/tc_str_val.rb~
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
require 'tc_helper.rb'
|
2
|
-
|
3
|
-
class TestStrVal < Test::Unit::TestCase
|
4
|
-
|
5
|
-
def setup
|
6
|
-
@str_val = Axlsx::StrVal.new :v => "1"
|
7
|
-
end
|
8
|
-
|
9
|
-
def test_initialize
|
10
|
-
assert_equal(@str_val.v,"1")
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_validate_string
|
14
|
-
assert_raise(ArgumentError) { Axlsx::StrVal.new :v => 1 }
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_to_xml_string
|
18
|
-
str = '<?xml version="1.0" encoding="UTF-8"?>'
|
19
|
-
str << '<c:chartSpace xmlns:c="' << Axlsx::XML_NS_C << '">'
|
20
|
-
str << @str_val.to_xml_string(0)
|
21
|
-
doc = Nokogiri::XML(str)
|
22
|
-
assert_equal(doc.xpath("//c:pt/c:v[text()='1']").size, 1)
|
23
|
-
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|
File without changes
|
@@ -1,72 +0,0 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
require 'tc_helper.rb'
|
3
|
-
|
4
|
-
class TestTable < Test::Unit::TestCase
|
5
|
-
def setup
|
6
|
-
p = Axlsx::Package.new
|
7
|
-
@ws = p.workbook.add_worksheet
|
8
|
-
40.times do
|
9
|
-
@ws << ["aa","aa","aa","aa","aa","aa"]
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_initialization
|
14
|
-
assert(@ws.workbook.tables.empty?)
|
15
|
-
assert(@ws.tables.empty?)
|
16
|
-
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_add_table
|
20
|
-
name = "test"
|
21
|
-
table = @ws.add_table("A1:D5", :name => name)
|
22
|
-
assert(table.is_a?(Axlsx::Table), "must create a table")
|
23
|
-
assert_equal(@ws.workbook.tables.last, table, "must be added to workbook table collection")
|
24
|
-
assert_equal(@ws.tables.last, table, "must be added to worksheet table collection")
|
25
|
-
assert_equal(table.name, name, "options for name are applied")
|
26
|
-
|
27
|
-
end
|
28
|
-
|
29
|
-
def test_charts
|
30
|
-
assert(@ws.drawing.charts.empty?)
|
31
|
-
chart = @ws.add_chart(Axlsx::Pie3DChart, :title=>"bob", :start_at=>[0,0], :end_at=>[1,1])
|
32
|
-
assert_equal(@ws.drawing.charts.last, chart, "add chart is returned")
|
33
|
-
chart = @ws.add_chart(Axlsx::Pie3DChart, :title=>"nancy", :start_at=>[1,5], :end_at=>[5,10])
|
34
|
-
assert_equal(@ws.drawing.charts.last, chart, "add chart is returned")
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_pn
|
38
|
-
table = @ws.add_table("A1:D5")
|
39
|
-
assert_equal(@ws.tables.first.pn, "tables/table1.xml")
|
40
|
-
end
|
41
|
-
|
42
|
-
def test_rId
|
43
|
-
table = @ws.add_table("A1:D5")
|
44
|
-
assert_equal(@ws.tables.first.rId, "rId1")
|
45
|
-
end
|
46
|
-
|
47
|
-
def test_index
|
48
|
-
table = @ws.add_table("A1:D5")
|
49
|
-
assert_equal(@ws.tables.first.index, @ws.workbook.tables.index(@ws.tables.first))
|
50
|
-
end
|
51
|
-
|
52
|
-
def test_relationships
|
53
|
-
assert(@ws.relationships.empty?)
|
54
|
-
table = @ws.add_table("A1:D5")
|
55
|
-
assert_equal(@ws.relationships.size, 1, "adding a table adds a relationship")
|
56
|
-
table = @ws.add_table("F1:J5")
|
57
|
-
assert_equal(@ws.relationships.size, 2, "adding a table adds a relationship")
|
58
|
-
end
|
59
|
-
|
60
|
-
def test_to_xml
|
61
|
-
table = @ws.add_table("A1:D5")
|
62
|
-
schema = Nokogiri::XML::Schema(File.open(Axlsx::SML_XSD))
|
63
|
-
doc = Nokogiri::XML(table.to_xml)
|
64
|
-
errors = []
|
65
|
-
schema.validate(doc).each do |error|
|
66
|
-
errors.push error
|
67
|
-
puts error.message
|
68
|
-
end
|
69
|
-
assert(errors.empty?, "error free validation")
|
70
|
-
end
|
71
|
-
|
72
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
require 'tc_helper.rb'
|
2
|
-
|
3
|
-
class TestConditionalFormatting < Test::Unit::TestCase
|
4
|
-
def setup
|
5
|
-
cfvo = Axlsx::Cfvo.new :val => 0, :type => :min
|
6
|
-
end
|
7
|
-
|
8
|
-
def test_val
|
9
|
-
assert_raise(ArgumentError) { cfvo.val = 0 }
|
10
|
-
assert_nothing_raised { cfvo.val = "abc" }
|
11
|
-
assert_equal(cfvo.val, "abc")
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_type
|
15
|
-
assert_raise(ArgumentError) { cfvo.type = :invalid_type }
|
16
|
-
assert_nothing_raised { cfvo.type = :max }
|
17
|
-
assert_equal(cfvo.type, :max)
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|
File without changes
|
File without changes
|
File without changes
|