axlsx 1.1.7 → 1.1.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. data/README.md +41 -5
  2. data/Rakefile +3 -2
  3. data/examples/chart_colors.rb +18 -3
  4. data/examples/example.rb +100 -46
  5. data/examples/extractive.pdf +0 -0
  6. data/lib/axlsx.rb +7 -6
  7. data/lib/axlsx/content_type/content_type.rb +2 -0
  8. data/lib/axlsx/content_type/default.rb +21 -12
  9. data/lib/axlsx/content_type/override.rb +22 -11
  10. data/lib/axlsx/doc_props/app.rb +36 -32
  11. data/lib/axlsx/doc_props/core.rb +9 -5
  12. data/lib/axlsx/drawing/ax_data_source.rb +7 -6
  13. data/lib/axlsx/drawing/axis.rb +48 -27
  14. data/lib/axlsx/drawing/bar_3D_chart.rb +47 -37
  15. data/lib/axlsx/drawing/bar_series.rb +1 -0
  16. data/lib/axlsx/drawing/cat_axis.rb +42 -38
  17. data/lib/axlsx/drawing/chart.rb +34 -27
  18. data/lib/axlsx/drawing/drawing.rb +5 -4
  19. data/lib/axlsx/drawing/line_3D_chart.rb +1 -1
  20. data/lib/axlsx/drawing/num_data_source.rb +1 -1
  21. data/lib/axlsx/drawing/pie_3D_chart.rb +7 -7
  22. data/lib/axlsx/drawing/two_cell_anchor.rb +3 -8
  23. data/lib/axlsx/drawing/view_3D.rb +41 -31
  24. data/lib/axlsx/drawing/vml_drawing.rb +1 -1
  25. data/lib/axlsx/package.rb +11 -11
  26. data/lib/axlsx/rels/relationship.rb +3 -3
  27. data/lib/axlsx/stylesheet/styles.rb +1 -1
  28. data/lib/axlsx/util/constants.rb +4 -0
  29. data/lib/axlsx/util/simple_typed_list.rb +2 -2
  30. data/lib/axlsx/util/validators.rb +2 -2
  31. data/lib/axlsx/version.rb +1 -1
  32. data/lib/axlsx/workbook/workbook.rb +1 -2
  33. data/lib/axlsx/workbook/worksheet/cell.rb +1 -1
  34. data/lib/axlsx/workbook/worksheet/data_bar.rb +1 -1
  35. data/lib/axlsx/workbook/worksheet/page_setup.rb +9 -0
  36. data/lib/axlsx/workbook/worksheet/protected_range.rb +46 -0
  37. data/lib/axlsx/workbook/worksheet/worksheet.rb +180 -56
  38. data/test/content_type/tc_content_type.rb +1 -6
  39. data/test/doc_props/tc_core.rb +1 -1
  40. data/test/drawing/tc_axis.rb +8 -0
  41. data/test/drawing/tc_bar_3D_chart.rb +12 -12
  42. data/test/drawing/tc_bar_series.rb +0 -1
  43. data/test/drawing/tc_chart.rb +1 -5
  44. data/test/drawing/tc_pie_3D_chart.rb +3 -7
  45. data/test/drawing/tc_view_3D.rb +18 -18
  46. data/test/tc_package.rb +2 -0
  47. data/test/workbook/worksheet/tc_page_setup.rb +20 -3
  48. data/test/workbook/worksheet/tc_protected_range.rb +18 -0
  49. data/test/workbook/worksheet/tc_selection.rb +1 -1
  50. data/test/workbook/worksheet/tc_worksheet.rb +39 -18
  51. metadata +54 -103
  52. data/examples/axis-titles.xlsx +0 -0
  53. data/examples/basic_charts.xlsx +0 -0
  54. data/examples/chart_colors.xlsx +0 -0
  55. data/examples/charts.xlsx +0 -0
  56. data/examples/conditional_formatting/getting_barred.xlsx +0 -0
  57. data/examples/doc/_index.html +0 -84
  58. data/examples/doc/class_list.html +0 -47
  59. data/examples/doc/css/common.css +0 -1
  60. data/examples/doc/css/full_list.css +0 -55
  61. data/examples/doc/css/style.css +0 -322
  62. data/examples/doc/file_list.html +0 -46
  63. data/examples/doc/frames.html +0 -13
  64. data/examples/doc/index.html +0 -84
  65. data/examples/doc/js/app.js +0 -205
  66. data/examples/doc/js/full_list.js +0 -173
  67. data/examples/doc/js/jquery.js +0 -16
  68. data/examples/doc/method_list.html +0 -46
  69. data/examples/doc/top-level-namespace.html +0 -95
  70. data/examples/example.xlsx +0 -0
  71. data/examples/example_streamed.xlsx +0 -0
  72. data/examples/examples_saved.xlsx +0 -0
  73. data/examples/extractive.xlsx +0 -0
  74. data/examples/fish.xlsx +0 -0
  75. data/examples/no-use_autowidth.xlsx +0 -0
  76. data/examples/pareto.rb +0 -28
  77. data/examples/pareto.xlsx +0 -0
  78. data/examples/pie_chart_excel.xlsx +0 -0
  79. data/examples/pie_chart_saved.xlsx +0 -0
  80. data/examples/shared_strings_example.xlsx +0 -0
  81. data/examples/sheet_protection.xlsx +0 -0
  82. data/examples/sheet_view.xlsx +0 -0
  83. data/examples/two_cell_anchor_image.xlsx +0 -0
  84. data/examples/~$example.xlsx +0 -0
  85. data/lib/axlsx/drawing/ax_data_source.rb~ +0 -55
  86. data/lib/axlsx/drawing/data_source.rb~ +0 -51
  87. data/lib/axlsx/drawing/hlink_click.rb~ +0 -0
  88. data/lib/axlsx/drawing/hyperlink.rb~ +0 -64
  89. data/lib/axlsx/drawing/num_data.rb~ +0 -51
  90. data/lib/axlsx/drawing/num_data_source.rb~ +0 -54
  91. data/lib/axlsx/drawing/num_val.rb~ +0 -40
  92. data/lib/axlsx/drawing/picture_locking.rb~ +0 -36
  93. data/lib/axlsx/drawing/ref.rb~ +0 -41
  94. data/lib/axlsx/drawing/str_data.rb~ +0 -58
  95. data/lib/axlsx/drawing/str_val.rb~ +0 -35
  96. data/lib/axlsx/drawing/vml_drawing.rb~ +0 -6
  97. data/lib/axlsx/drawing/vml_shape.rb~ +0 -61
  98. data/lib/axlsx/util/cbf.rb +0 -333
  99. data/lib/axlsx/util/cfb.rb~ +0 -201
  100. data/lib/axlsx/util/font_tables.rb~ +0 -0
  101. data/lib/axlsx/util/ms_off_crypto.rb +0 -189
  102. data/lib/axlsx/util/ms_off_crypto.rb~ +0 -3
  103. data/lib/axlsx/util/ms_offcrypto.rb~ +0 -0
  104. data/lib/axlsx/util/parser.rb~ +0 -6
  105. data/lib/axlsx/util/storage.rb~ +0 -0
  106. data/lib/axlsx/workbook/shared_strings_table.rb~ +0 -69
  107. data/lib/axlsx/workbook/worksheet/cfvo.rb~ +0 -0
  108. data/lib/axlsx/workbook/worksheet/col.rb~ +0 -0
  109. data/lib/axlsx/workbook/worksheet/color_scale.rb~ +0 -46
  110. data/lib/axlsx/workbook/worksheet/comment.rb~ +0 -91
  111. data/lib/axlsx/workbook/worksheet/comments.rb~ +0 -86
  112. data/lib/axlsx/workbook/worksheet/data_bar.rb~ +0 -0
  113. data/lib/axlsx/workbook/worksheet/icon_set.rb~ +0 -95
  114. data/lib/axlsx/workbook/worksheet/shared_strings_table.rb~ +0 -0
  115. data/lib/axlsx/workbook/worksheet/table.rb~ +0 -97
  116. data/lib/schema/dc.xsd~ +0 -118
  117. data/lib/schema/dcterms.xsd~ +0 -331
  118. data/lib/schema/opc-coreProperties.xsd~ +0 -50
  119. data/test/drawing/tc_data_source.rb~ +0 -30
  120. data/test/drawing/tc_num_data.rb~ +0 -35
  121. data/test/drawing/tc_num_val.rb~ +0 -29
  122. data/test/drawing/tc_str_data.rb~ +0 -30
  123. data/test/drawing/tc_str_val.rb~ +0 -26
  124. data/test/drawing/tc_vml_drawing.rb~ +0 -0
  125. data/test/workbook/worksheet/table/tc_table.rb~ +0 -72
  126. data/test/workbook/worksheet/tc_cfvo.rb~ +0 -20
  127. data/test/workbook/worksheet/tc_col.rb~ +0 -10
  128. data/test/workbook/worksheet/tc_color_scale.rb~ +0 -0
  129. data/test/workbook/worksheet/tc_data_bar.rb~ +0 -0
  130. 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
@@ -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
@@ -1,10 +0,0 @@
1
- require 'tc_helper.rb'
2
-
3
- class TestCol < Test::Unit::TestCase
4
-
5
- def setup
6
-
7
- end
8
-
9
-
10
- end
File without changes
File without changes