axlsx 1.1.4 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.yardopts +5 -2
- data/CHANGELOG.md +39 -0
- data/README.md +108 -31
- data/Rakefile +11 -3
- data/examples/basic_charts.rb +54 -0
- data/examples/chart_colors.rb +17 -2
- data/examples/data_validation.rb +50 -0
- data/examples/example.rb +130 -47
- data/examples/example.xlsx +0 -0
- data/examples/example_streamed.xlsx +0 -0
- data/examples/extractive.pdf +0 -0
- data/examples/extractive.rb +3 -0
- data/examples/no-use_autowidth.xlsx +0 -0
- data/examples/scraping_html.rb +91 -0
- data/examples/shared_strings_example.xlsx +0 -0
- data/examples/sheet_protection.rb +10 -0
- data/examples/sheet_view.rb +34 -0
- data/examples/two_cell_anchor_image.rb +11 -0
- data/lib/axlsx/content_type/content_type.rb +2 -0
- data/lib/axlsx/content_type/default.rb +30 -15
- data/lib/axlsx/content_type/override.rb +29 -14
- data/lib/axlsx/doc_props/app.rb +161 -104
- 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 +82 -36
- data/lib/axlsx/drawing/bar_3D_chart.rb +49 -45
- data/lib/axlsx/drawing/bar_series.rb +2 -1
- data/lib/axlsx/drawing/cat_axis.rb +43 -39
- data/lib/axlsx/drawing/chart.rb +65 -54
- data/lib/axlsx/drawing/d_lbls.rb +100 -0
- data/lib/axlsx/drawing/drawing.rb +20 -8
- data/lib/axlsx/drawing/graphic_frame.rb +2 -1
- data/lib/axlsx/drawing/line_3D_chart.rb +3 -10
- data/lib/axlsx/drawing/num_data.rb +2 -2
- data/lib/axlsx/drawing/num_data_source.rb +4 -1
- data/lib/axlsx/drawing/pic.rb +44 -4
- data/lib/axlsx/drawing/pie_3D_chart.rb +10 -7
- data/lib/axlsx/drawing/scatter_chart.rb +2 -8
- data/lib/axlsx/drawing/title.rb +21 -9
- data/lib/axlsx/drawing/two_cell_anchor.rb +46 -9
- data/lib/axlsx/drawing/view_3D.rb +41 -31
- data/lib/axlsx/drawing/vml_drawing.rb +42 -0
- data/lib/axlsx/drawing/vml_shape.rb +125 -0
- data/lib/axlsx/package.rb +44 -16
- data/lib/axlsx/rels/relationship.rb +3 -3
- data/lib/axlsx/rels/relationships.rb +1 -11
- data/lib/axlsx/stylesheet/gradient_fill.rb +1 -1
- data/lib/axlsx/stylesheet/styles.rb +1 -1
- data/lib/axlsx/stylesheet/table_style.rb +3 -3
- data/lib/axlsx/util/constants.rb +28 -0
- data/lib/axlsx/util/simple_typed_list.rb +15 -21
- data/lib/axlsx/util/validators.rb +80 -7
- data/lib/axlsx/version.rb +2 -7
- data/lib/axlsx/workbook/defined_name.rb +174 -0
- data/lib/axlsx/workbook/defined_names.rb +21 -0
- data/lib/axlsx/workbook/workbook.rb +65 -13
- data/lib/axlsx/workbook/worksheet/auto_filter.rb +34 -0
- data/lib/axlsx/workbook/worksheet/cell.rb +35 -7
- data/lib/axlsx/workbook/worksheet/col.rb +15 -0
- data/lib/axlsx/workbook/worksheet/cols.rb +20 -0
- data/lib/axlsx/workbook/worksheet/comment.rb +101 -0
- data/lib/axlsx/workbook/worksheet/comments.rb +85 -0
- data/lib/axlsx/workbook/worksheet/conditional_formattings.rb +25 -0
- data/lib/axlsx/workbook/worksheet/data_bar.rb +1 -1
- data/lib/axlsx/workbook/worksheet/data_validation.rb +245 -0
- data/lib/axlsx/workbook/worksheet/data_validations.rb +28 -0
- data/lib/axlsx/workbook/worksheet/dimension.rb +65 -0
- data/lib/axlsx/workbook/worksheet/merged_cells.rb +35 -0
- data/lib/axlsx/workbook/worksheet/page_setup.rb +113 -0
- data/lib/axlsx/workbook/worksheet/pane.rb +144 -0
- data/lib/axlsx/workbook/worksheet/print_options.rb +63 -0
- data/lib/axlsx/workbook/worksheet/protected_range.rb +46 -0
- data/lib/axlsx/workbook/worksheet/protected_ranges.rb +34 -0
- data/lib/axlsx/workbook/worksheet/row.rb +36 -20
- data/lib/axlsx/workbook/worksheet/selection.rb +111 -0
- data/lib/axlsx/workbook/worksheet/sheet_data.rb +25 -0
- data/lib/axlsx/workbook/worksheet/sheet_pr.rb +24 -0
- data/lib/axlsx/workbook/worksheet/sheet_protection.rb +224 -0
- data/lib/axlsx/workbook/worksheet/sheet_view.rb +379 -0
- data/lib/axlsx/workbook/worksheet/table.rb +2 -2
- data/lib/axlsx/workbook/worksheet/tables.rb +31 -0
- data/lib/axlsx/workbook/worksheet/worksheet.rb +377 -255
- data/lib/axlsx/workbook/worksheet/worksheet_comments.rb +57 -0
- data/lib/axlsx/workbook/worksheet/worksheet_drawing.rb +64 -0
- data/lib/axlsx.rb +30 -15
- data/test/content_type/tc_content_type.rb +1 -6
- data/test/doc_props/tc_app.rb +31 -1
- data/test/doc_props/tc_core.rb +3 -1
- data/test/drawing/tc_axis.rb +38 -3
- data/test/drawing/tc_bar_3D_chart.rb +12 -12
- data/test/drawing/tc_bar_series.rb +1 -2
- data/test/drawing/tc_cat_axis.rb +3 -3
- data/test/drawing/tc_chart.rb +29 -9
- data/test/drawing/tc_d_lbls.rb +47 -0
- data/test/drawing/tc_drawing.rb +11 -5
- data/test/drawing/tc_hyperlink.rb +4 -5
- data/test/drawing/tc_line_series.rb +7 -3
- data/test/drawing/tc_num_data.rb +5 -1
- data/test/drawing/tc_pic.rb +22 -2
- data/test/drawing/tc_pie_3D_chart.rb +4 -8
- data/test/drawing/tc_pie_series.rb +7 -2
- data/test/drawing/tc_scatter_chart.rb +6 -1
- data/test/drawing/tc_scatter_series.rb +1 -1
- data/test/drawing/tc_series.rb +1 -1
- data/test/drawing/tc_title.rb +16 -0
- data/test/drawing/tc_two_cell_anchor.rb +1 -2
- data/test/drawing/tc_view_3D.rb +18 -18
- data/test/drawing/tc_vml_drawing.rb +25 -0
- data/test/drawing/tc_vml_shape.rb +100 -0
- data/test/rels/tc_relationship.rb +1 -0
- data/test/stylesheet/tc_gradient_fill.rb +8 -0
- data/test/stylesheet/tc_pattern_fill.rb +7 -1
- data/test/stylesheet/tc_styles.rb +3 -4
- data/test/stylesheet/tc_table_style.rb +8 -0
- data/test/stylesheet/tc_table_style_element.rb +10 -1
- data/test/tc_helper.rb +1 -0
- data/test/tc_package.rb +93 -17
- data/test/util/tc_simple_typed_list.rb +13 -0
- data/test/util/tc_validators.rb +95 -9
- data/test/workbook/tc_defined_name.rb +41 -0
- data/test/workbook/tc_workbook.rb +5 -3
- data/test/workbook/worksheet/table/tc_table.rb +3 -11
- data/test/workbook/worksheet/tc_cell.rb +30 -6
- data/test/workbook/worksheet/tc_col.rb +9 -0
- data/test/workbook/worksheet/tc_comment.rb +57 -0
- data/test/workbook/worksheet/tc_comments.rb +57 -0
- data/test/workbook/worksheet/tc_conditional_formatting.rb +44 -0
- data/test/workbook/worksheet/tc_data_bar.rb +1 -1
- data/test/workbook/worksheet/tc_data_validation.rb +265 -0
- data/test/workbook/worksheet/tc_page_setup.rb +138 -0
- data/test/workbook/worksheet/tc_pane.rb +94 -0
- data/test/workbook/worksheet/tc_print_options.rb +72 -0
- data/test/workbook/worksheet/tc_protected_range.rb +17 -0
- data/test/workbook/worksheet/tc_row.rb +32 -14
- data/test/workbook/worksheet/tc_selection.rb +94 -0
- data/test/workbook/worksheet/tc_sheet_protection.rb +117 -0
- data/test/workbook/worksheet/tc_sheet_view.rb +214 -0
- data/test/workbook/worksheet/tc_worksheet.rb +138 -48
- metadata +140 -80
- data/examples/#extractive.csv# +0 -0
- data/examples/#extractive.rb# +0 -45
- data/examples/chart_colors.rb~ +0 -0
- data/examples/chart_colors.xlsx +0 -0
- data/examples/colored_series_data.xlsx +0 -0
- data/examples/conditional_formatting/getting_barred.xlsx +0 -0
- data/examples/example.csv +0 -1000
- data/examples/extractive.csv +0 -1
- data/examples/extractive.csv~ +0 -1
- data/examples/extractive.rb~ +0 -3
- data/examples/extractive.xlsx +0 -0
- data/examples/stack.rb +0 -21
- data/examples/stack.rb~ +0 -27
- data/examples/stack.xlsx +0 -0
- data/examples/~$chart_colors.xlsx +0 -0
- data/examples/~$extractive.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/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/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/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
data/.yardopts
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,44 @@
|
|
|
1
1
|
CHANGELOG
|
|
2
2
|
---------
|
|
3
|
+
- **May.30.12**: 1.1.6 release
|
|
4
|
+
- data protection with passwords for sheets
|
|
5
|
+
- cell level input validators
|
|
6
|
+
- added support for two cell anchors for images
|
|
7
|
+
- test coverage now back up to 100%
|
|
8
|
+
- bugfix for merge cell sorting algorithm
|
|
9
|
+
- added fit_to method for page_setup to simplify managing witdh/height
|
|
10
|
+
- added ph (phonetics) and s (style) attributes for row.
|
|
11
|
+
- resolved all warnings generating from this gem.
|
|
12
|
+
- improved comment relationship management for multiple comments
|
|
13
|
+
|
|
14
|
+
- **May.13.12**: 1.1.5 release
|
|
15
|
+
- MOAR print options! You can now specify paper size, orientation,
|
|
16
|
+
fit to width, page margings and gridlines for printing.
|
|
17
|
+
- Support for adding comments to your worksheets
|
|
18
|
+
- bugfix for applying style to empty cells
|
|
19
|
+
- bugfix for parsing formula with multiple '='
|
|
20
|
+
|
|
21
|
+
- **May.3.12:**: 1.1.4 release
|
|
22
|
+
- MOAR examples
|
|
23
|
+
- added outline level for rows and columns
|
|
24
|
+
- rebuild of numeric and axis data sources for charts
|
|
25
|
+
- added delete to axis
|
|
26
|
+
- added tick and label mark skipping for cat axis in charts
|
|
27
|
+
- bugfix for table headers method
|
|
28
|
+
- sane(er) defaults for chart positioning
|
|
29
|
+
- bugfix in val_axis_data to properly serialize value axis data. Excel does not mind as it reads from the sheet, but nokogiri has a fit if the elements are empty.
|
|
30
|
+
- Added support for specifying the color of data series in charts.
|
|
31
|
+
- bugfix using add_cell on row mismanaged calls to update_column_info.
|
|
32
|
+
|
|
33
|
+
- ** April.25.12:**: 1.1.3 release
|
|
34
|
+
- Primarily because I am stupid.....Updates to readme to properly report version, add in missing docs and restructure example directory.
|
|
35
|
+
|
|
36
|
+
- ** April.25.12:**: 1.1.2 release
|
|
37
|
+
- Conditional Formatting completely implemented.
|
|
38
|
+
- refactoring / documentation for Style#add_style
|
|
39
|
+
- added in label rotation for chart axis labels
|
|
40
|
+
- bugfix to properly assign style and type info to cells when only partial information is provided in the types/style option
|
|
41
|
+
|
|
3
42
|
- ** April.18.12**: 1.1.1 release
|
|
4
43
|
- bugfix for autowidth calculations across multiple rows
|
|
5
44
|
- bugfix for dimension calculations with nil cells.
|
data/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
Axlsx: Office Open XML Spreadsheet Generation
|
|
2
2
|
====================================
|
|
3
3
|
[](http://travis-ci.org/randym/axlsx/)
|
|
4
|
+
[](http://www.pledgie.com/campaigns/17814)
|
|
4
5
|
|
|
5
6
|
**IRC**:[irc.freenode.net / #axlsx](irc://irc.freenode.net/axlsx)
|
|
6
7
|
|
|
@@ -16,7 +17,7 @@ Axlsx: Office Open XML Spreadsheet Generation
|
|
|
16
17
|
|
|
17
18
|
**License**: MIT License
|
|
18
19
|
|
|
19
|
-
**Latest Version**: 1.
|
|
20
|
+
**Latest Version**: 1.2.0
|
|
20
21
|
|
|
21
22
|
**Ruby Version**: 1.8.7, 1.9.2, 1.9.3
|
|
22
23
|
|
|
@@ -24,19 +25,32 @@ Axlsx: Office Open XML Spreadsheet Generation
|
|
|
24
25
|
|
|
25
26
|
**Rubinius Version**: rubinius 2.0.0dev * lower versions may run, this gem always tests against head.
|
|
26
27
|
|
|
27
|
-
**Release Date**:
|
|
28
|
+
**Release Date**: August 5th 2012
|
|
28
29
|
|
|
29
30
|
If you are working in rails, or with active record see:
|
|
30
|
-
http://github.com/randym/acts_as_xlsx
|
|
31
|
+
* http://github.com/randym/acts_as_xlsx
|
|
32
|
+
acts_as_xlsx is a simple ActiveRecord mixin that lets you generate a workbook with:
|
|
33
|
+
|
|
34
|
+
```ruby
|
|
35
|
+
Posts.where(created_at > Time.now-30.days).to_xlsx
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
** and **
|
|
39
|
+
|
|
40
|
+
* http://github.com/straydogstudio/axlsx_rails
|
|
41
|
+
Axlsx_Rails provides an Axlsx renderer so you can move all your spreadsheet code from your controller into view files. Partials are supported so you can organize any code into reusable chunks (e.g. cover sheets, common styling, etc.) You can use it with acts_as_xlsx, placing the to_xlsx call in a view and add ':package => xlsx_package' to the parameter list. Now you can keep your controllers thin!
|
|
31
42
|
|
|
32
43
|
There are guides for using axlsx and acts_as_xlsx here:
|
|
33
|
-
[http://axlsx.
|
|
44
|
+
[http://axlsx.blog.randym.net](http://axlsx.blog.randym.net)
|
|
45
|
+
|
|
46
|
+
The examples directory contains a number of more specific examples as
|
|
47
|
+
well.
|
|
34
48
|
|
|
35
49
|
Synopsis
|
|
36
50
|
--------
|
|
37
51
|
|
|
38
52
|
Axlsx is an Office Open XML Spreadsheet generator for the Ruby programming language.
|
|
39
|
-
With Axlsx you can create excel worksheets with charts, images (with links), automated and fixed column widths, customized styles, functions, merged cells, auto filters, file and stream serialization as well as full schema validation. Axlsx excels at helping you generate beautiful Office Open XML Spreadsheet documents without having to understand the entire ECMA specification.
|
|
53
|
+
With Axlsx you can create excel worksheets with charts, images (with links), automated and fixed column widths, customized styles, functions, tables, conditional formatting, print options, comments, merged cells, auto filters, file and stream serialization as well as full schema validation. Axlsx excels at helping you generate beautiful Office Open XML Spreadsheet documents without having to understand the entire ECMA specification.
|
|
40
54
|
|
|
41
55
|

|
|
42
56
|
|
|
@@ -63,9 +77,8 @@ Feature List
|
|
|
63
77
|
|
|
64
78
|
**9. Cell level style overrides for default and customized style objects
|
|
65
79
|
|
|
66
|
-
**10. Support for formulas
|
|
67
|
-
|
|
68
|
-
**11. Support for cell merging as well as column and row outline
|
|
80
|
+
**10. Support for formulas, merging, row and column outlining as well as
|
|
81
|
+
cell level input data validation.
|
|
69
82
|
|
|
70
83
|
**12. Auto filtering tables with worksheet.auto_filter as well as support for Tables
|
|
71
84
|
|
|
@@ -75,6 +88,15 @@ Feature List
|
|
|
75
88
|
|
|
76
89
|
**15. Support for page margins and print options
|
|
77
90
|
|
|
91
|
+
**16. Support for password and non password based sheet protection.
|
|
92
|
+
|
|
93
|
+
**17. First stage interoperability support for GoogleDocs, LibreOffice,
|
|
94
|
+
and Numbers
|
|
95
|
+
|
|
96
|
+
**18. Support for defined names, which gives you repeated header rows for printing.
|
|
97
|
+
|
|
98
|
+
**19. Data labels for charts as well as series color customization.
|
|
99
|
+
|
|
78
100
|
Installing
|
|
79
101
|
----------
|
|
80
102
|
|
|
@@ -86,12 +108,28 @@ To install Axlsx, use the following command:
|
|
|
86
108
|
------
|
|
87
109
|
|
|
88
110
|
The example listing is getting overly large to maintain here.
|
|
89
|
-
If you are using Yard, you will be able to see the examples
|
|
90
|
-
|
|
111
|
+
If you are using Yard, you will be able to see the examples in line below.
|
|
112
|
+
|
|
113
|
+
Here's a teaser that kicks about 2% of what the gem can do.
|
|
114
|
+
|
|
115
|
+
```ruby
|
|
116
|
+
Axlsx::Package.new do |p|
|
|
117
|
+
p.workbook.add_worksheet(:name => "Pie Chart") do |sheet|
|
|
118
|
+
sheet.add_row ["Simple Pie Chart"]
|
|
119
|
+
%w(first second third).each { |label| sheet.add_row [label, rand(24)+1] }
|
|
120
|
+
sheet.add_chart(Axlsx::Pie3DChart, :start_at => [0,5], :end_at => [10, 20], :title => "example 3: Pie Chart") do |chart|
|
|
121
|
+
chart.add_series :data => sheet["B2:B4"], :labels => sheet["A2:A4"], :colors => ['FF0000', '00FF00', '0000FF']
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
p.serialize('simple.xlsx')
|
|
125
|
+
end
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Please see the [examples](https://github.com/randym/axlsx/tree/master/examples/example.rb) for more.
|
|
91
129
|
|
|
92
130
|
{include:file:examples/example.rb}
|
|
93
131
|
|
|
94
|
-
There is much, much more you can do with this gem. If you get stuck, grab me on IRC or submit an issue to
|
|
132
|
+
There is much, much more you can do with this gem. If you get stuck, grab me on IRC or submit an issue to GitHub. Chances are that it has already been implemented. If it hasn't - let's take a look at adding it in.
|
|
95
133
|
|
|
96
134
|
#Documentation
|
|
97
135
|
--------------
|
|
@@ -107,30 +145,63 @@ This gem has 100% test coverage using test/unit. To execute tests for this gem,
|
|
|
107
145
|
|
|
108
146
|
#Change log
|
|
109
147
|
---------
|
|
110
|
-
- **
|
|
111
|
-
-
|
|
112
|
-
- added
|
|
113
|
-
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
-
|
|
117
|
-
-
|
|
118
|
-
- bugfix
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
-
|
|
124
|
-
|
|
125
|
-
-
|
|
126
|
-
|
|
127
|
-
-
|
|
128
|
-
|
|
129
|
-
|
|
148
|
+
- **August.5.12**: 1.2.0
|
|
149
|
+
- rebuilt worksheet serialization to clean up the code base a bit.
|
|
150
|
+
- added data labels for charts
|
|
151
|
+
- added table header printing for each sheet via defined_name. This
|
|
152
|
+
means that when you print your worksheet, the header rows show for every page
|
|
153
|
+
- **July.??.12**: 1.1.9 release
|
|
154
|
+
- lots of code clean up for worksheet
|
|
155
|
+
- added in data labels for pie charts, line charts and bar charts.
|
|
156
|
+
- bugfix chard with data in a sheet that has a space in the name are
|
|
157
|
+
now auto updating formula based values
|
|
158
|
+
- **July.14.12**: 1.1.8 release
|
|
159
|
+
- added html entity encoding for sheet names. This allows you to use
|
|
160
|
+
characters like '<' and '&' in your sheet names.
|
|
161
|
+
- new - first round google docs interoperability
|
|
162
|
+
- added filter to strip out control characters from cell data.
|
|
163
|
+
- added in interop requirements so that charts are properly exported
|
|
164
|
+
to PDF from Libra Office
|
|
165
|
+
- various readability improvements and work standardizing attribute
|
|
166
|
+
names to snake_case. Aliases are provided for backward compatiblity
|
|
167
|
+
- **June.11.12**: 1.1.7 release
|
|
168
|
+
- fix chart rendering issue when label offset is specified as a
|
|
169
|
+
percentage in serialization and ensure that formula are not stored
|
|
170
|
+
in value caches
|
|
171
|
+
- fix bug that causes repair warnings when using a text only title reference.
|
|
172
|
+
- Add title property to axis so you can lable the x/y/series axis for
|
|
173
|
+
charts.
|
|
174
|
+
- Add sheet views with panes
|
|
130
175
|
|
|
131
176
|
Please see the {file:CHANGELOG.md} document for past release information.
|
|
132
177
|
|
|
178
|
+
# Known interoperability issues.
|
|
179
|
+
As axslx implements the Office Open XML (ECMA-376 spec) much of the
|
|
180
|
+
functionality is interoperable with other spreadsheet software. Below is
|
|
181
|
+
a listing of some known issues.
|
|
182
|
+
|
|
183
|
+
1. Libra Office
|
|
184
|
+
- You must specify colors for your series. see examples/chart_colors.rb
|
|
185
|
+
for an example.
|
|
186
|
+
- You must use data in your sheet for charts. You cannot use hard coded
|
|
187
|
+
values.
|
|
188
|
+
- Chart axis and gridlines do not render. I have a feeling this is
|
|
189
|
+
related to themes, which axlsx does not implement at this time.
|
|
190
|
+
|
|
191
|
+
2. Google Docs
|
|
192
|
+
- Images are known to not work with google docs
|
|
193
|
+
- border colors do not work
|
|
194
|
+
|
|
195
|
+
3. Numbers
|
|
196
|
+
- you must set 'use_shared_strings' to true
|
|
197
|
+
- charts do not render
|
|
198
|
+
|
|
199
|
+
|
|
133
200
|
#Thanks!
|
|
201
|
+
|
|
202
|
+
Open source software is a community effort. None of this could have been
|
|
203
|
+
done without the help of the people below.
|
|
204
|
+
|
|
134
205
|
--------
|
|
135
206
|
[ochko](https://github.com/ochko) - for performance fixes, kicking the crap out of axlsx and helping to maintain my general sanity.
|
|
136
207
|
|
|
@@ -152,6 +223,12 @@ Please see the {file:CHANGELOG.md} document for past release information.
|
|
|
152
223
|
|
|
153
224
|
[scpike](https://github.com/scpike) - for keeping numbers fixed even when they are rational and a super clean implementation of conditional formatting.
|
|
154
225
|
|
|
226
|
+
[janhuehne](https://github.com/janhuehne) - for working out the decoder ring and adding in cell level validation, and providing a support for window panes.
|
|
227
|
+
|
|
228
|
+
[rfc2616](https://github.com/rfc2616) - for FINALLY working out the interop issues with google docs.
|
|
229
|
+
|
|
230
|
+
[straydogstudio](https://github.com/straydocstudio) - For making an AWESOME axlsx templating gem for rails.
|
|
231
|
+
|
|
155
232
|
#Copyright and License
|
|
156
233
|
----------
|
|
157
234
|
|
data/Rakefile
CHANGED
|
@@ -9,7 +9,9 @@ task :benchmark do
|
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
task :gendoc do
|
|
12
|
-
|
|
12
|
+
#puts 'yard doc generation disabled until JRuby build native extensions for redcarpet or yard removes the dependency.'
|
|
13
|
+
system "yardoc"
|
|
14
|
+
system "yard stats --list-undoc"
|
|
13
15
|
end
|
|
14
16
|
|
|
15
17
|
task :test do
|
|
@@ -17,12 +19,18 @@ task :test do
|
|
|
17
19
|
Rake::TestTask.new do |t|
|
|
18
20
|
t.libs << 'test'
|
|
19
21
|
t.test_files = FileList['test/**/tc_*.rb']
|
|
20
|
-
t.verbose =
|
|
22
|
+
t.verbose = false
|
|
23
|
+
t.warning = true
|
|
21
24
|
end
|
|
22
25
|
end
|
|
23
26
|
|
|
27
|
+
task :report do
|
|
28
|
+
require 'cover_me'
|
|
29
|
+
CoverMe.complete!
|
|
30
|
+
end
|
|
31
|
+
|
|
24
32
|
task :release => :build do
|
|
25
33
|
system "gem push axlsx-#{Axlsx::VERSION}.gem"
|
|
26
34
|
end
|
|
27
35
|
|
|
28
|
-
task :default => :test
|
|
36
|
+
task :default => :test
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../lib"
|
|
2
|
+
require 'axlsx'
|
|
3
|
+
p = Axlsx::Package.new
|
|
4
|
+
wb = p.workbook
|
|
5
|
+
|
|
6
|
+
# Pie Chart
|
|
7
|
+
wb.add_worksheet(:name => "Pie Chart") do |sheet|
|
|
8
|
+
sheet.add_row ["First", "Second", "Third", "Fourth"]
|
|
9
|
+
sheet.add_row [1, 2, 3, 4]
|
|
10
|
+
sheet.add_chart(Axlsx::Pie3DChart, :start_at => [0,2], :end_at => [5, 15], :title=> 'dark corner here') do |chart|
|
|
11
|
+
chart.add_series :data => sheet["A2:D2"], :labels => sheet["A1:D1"]
|
|
12
|
+
chart.d_lbls.show_val = true
|
|
13
|
+
chart.d_lbls.show_percent = true
|
|
14
|
+
chart.d_lbls.d_lbl_pos = :outEnd
|
|
15
|
+
chart.d_lbls.show_leader_lines = true
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# line chart
|
|
20
|
+
wb.add_worksheet(:name => "Line Chart") do |sheet|
|
|
21
|
+
sheet.add_row ['1', '2', '3', '4']
|
|
22
|
+
sheet.add_row [1, 2, 3, '=sum(A2:C2)']
|
|
23
|
+
sheet.add_chart(Axlsx::Line3DChart, :start_at => [0,2], :end_at => [5, 15], :title => "Chart") do |chart|
|
|
24
|
+
chart.add_series :data => sheet["A2:D2"], :labels => sheet["A1:D1"], :title => 'bob'
|
|
25
|
+
chart.d_lbls.show_val = true
|
|
26
|
+
chart.d_lbls.show_cat_name = true
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# bar chart
|
|
31
|
+
wb.add_worksheet(:name => "Bar Chart") do |sheet|
|
|
32
|
+
sheet.add_row ["A Simple Bar Chart"]
|
|
33
|
+
sheet.add_row ["First", "Second", "Third"]
|
|
34
|
+
sheet.add_row [1, 2, 3]
|
|
35
|
+
sheet.add_chart(Axlsx::Bar3DChart, :start_at => "A4", :end_at => "F17") do |chart|
|
|
36
|
+
chart.add_series :data => sheet["A3:C3"], :labels => sheet["A2:C2"], :title => sheet["A1"]
|
|
37
|
+
chart.valAxis.label_rotation = -45
|
|
38
|
+
chart.catAxis.label_rotation = 45
|
|
39
|
+
chart.d_lbls.d_lbl_pos = :outEnd
|
|
40
|
+
chart.d_lbls.show_val = true
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# specifying colors and title
|
|
45
|
+
wb.add_worksheet(:name => "Colored Pie Chart") do |sheet|
|
|
46
|
+
sheet.add_row ["First", "Second", "Third", "Fourth"]
|
|
47
|
+
sheet.add_row [1, 2, 3, "=PRODUCT(A2:C2)"]
|
|
48
|
+
sheet.add_chart(Axlsx::Pie3DChart, :start_at => [0,2], :end_at => [5, 15], :title => "example 3: Pie Chart") do |chart|
|
|
49
|
+
chart.add_series :data => sheet["A2:D2"], :labels => ["A1:D1"], :colors => ['FF0000', '00FF00', '0000FF']
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
p.serialize('basic_charts.xlsx')
|
|
54
|
+
|
data/examples/chart_colors.rb
CHANGED
|
@@ -36,7 +36,7 @@ end
|
|
|
36
36
|
sheet.add_row ["First", "Second", "Third", "Fourth"]
|
|
37
37
|
sheet.add_row [1, 2, 3, "=PRODUCT(A2:C2)"]
|
|
38
38
|
sheet.add_chart(Axlsx::Pie3DChart, :start_at => [0,2], :end_at => [5, 15], :title => "example 3: Pie Chart") do |chart|
|
|
39
|
-
chart.add_series :data => sheet["A2:D2"], :labels => sheet["A1:D1"], :colors => ['FF0000', '00FF00', '0000FF']
|
|
39
|
+
chart.add_series :data => sheet["A2:D2"], :labels => sheet["A1:D1"], :colors => ['FF0000', '00FF00', '0000FF', '000000']
|
|
40
40
|
end
|
|
41
41
|
end
|
|
42
42
|
|
|
@@ -45,7 +45,7 @@ end
|
|
|
45
45
|
wb.add_worksheet(:name => "Line Chart") do |sheet|
|
|
46
46
|
sheet.add_row ["First", 1, 5, 7, 9]
|
|
47
47
|
sheet.add_row ["Second", 5, 2, 14, 9]
|
|
48
|
-
sheet.add_chart(Axlsx::Line3DChart, :title => "example 6: Line Chart", :rotX => 30, :rotY =>
|
|
48
|
+
sheet.add_chart(Axlsx::Line3DChart, :title => "example 6: Line Chart", :rotX => 30, :rotY => 30) do |chart|
|
|
49
49
|
chart.start_at 0, 2
|
|
50
50
|
chart.end_at 10, 15
|
|
51
51
|
chart.add_series :data => sheet["B1:E1"], :title => sheet["A1"], :color => "FF0000"
|
|
@@ -53,6 +53,21 @@ wb.add_worksheet(:name => "Line Chart") do |sheet|
|
|
|
53
53
|
end
|
|
54
54
|
end
|
|
55
55
|
|
|
56
|
+
wb.add_worksheet(:name => 'Line Chart with Axis colors') do |sheet|
|
|
57
|
+
sheet.add_row ["First", 1, 5, 7, 9]
|
|
58
|
+
sheet.add_row ["Second", 5, 2, 14, 9]
|
|
59
|
+
sheet.add_chart(Axlsx::Line3DChart, :title => "example 7: Flat Line Chart", :rot_x => 0, :perspective => 0) do |chart|
|
|
60
|
+
chart.valAxis.color = "FFFF00"
|
|
61
|
+
chart.catAxis.color = "00FFFF"
|
|
62
|
+
chart.serAxis.delete = true
|
|
63
|
+
chart.start_at 0, 2
|
|
64
|
+
chart.end_at 10, 15
|
|
65
|
+
chart.add_series :data => sheet["B1:E1"], :title => sheet["A1"], :color => "FF0000"
|
|
66
|
+
chart.add_series :data => sheet["B2:E2"], :title => sheet["A2"], :color => "00FF00"
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
end
|
|
70
|
+
|
|
56
71
|
##Generating A Scatter Chart
|
|
57
72
|
|
|
58
73
|
wb.add_worksheet(:name => "Scatter Chart") do |sheet|
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
#!/usr/bin/env ruby -w -s
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../lib"
|
|
4
|
+
require 'axlsx'
|
|
5
|
+
|
|
6
|
+
p = Axlsx::Package.new
|
|
7
|
+
p.workbook.add_worksheet do |ws|
|
|
8
|
+
ws.add_data_validation("A10", {
|
|
9
|
+
:type => :whole,
|
|
10
|
+
:operator => :between,
|
|
11
|
+
:formula1 => '5',
|
|
12
|
+
:formula2 => '10',
|
|
13
|
+
:showErrorMessage => true,
|
|
14
|
+
:errorTitle => 'Wrong input',
|
|
15
|
+
:error => 'Only values between 5 and 10',
|
|
16
|
+
:errorStyle => :information,
|
|
17
|
+
:showInputMessage => true,
|
|
18
|
+
:promptTitle => 'Be carful!',
|
|
19
|
+
:prompt => 'Only values between 5 and 10'})
|
|
20
|
+
|
|
21
|
+
ws.add_data_validation("B10", {
|
|
22
|
+
:type => :textLength,
|
|
23
|
+
:operator => :greaterThan,
|
|
24
|
+
:formula1 => '10',
|
|
25
|
+
:showErrorMessage => true,
|
|
26
|
+
:errorTitle => 'Text is too long',
|
|
27
|
+
:error => 'Max text length is 10 characters',
|
|
28
|
+
:errorStyle => :stop,
|
|
29
|
+
:showInputMessage => true,
|
|
30
|
+
:promptTitle => 'Text length',
|
|
31
|
+
:prompt => 'Max text length is 10 characters'})
|
|
32
|
+
|
|
33
|
+
8.times do |i|
|
|
34
|
+
ws.add_row [nil, nil, i*2]
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
ws.add_data_validation("C10", {
|
|
38
|
+
:type => :list,
|
|
39
|
+
:formula1 => 'C1:C8',
|
|
40
|
+
:showDropDown => false,
|
|
41
|
+
:showErrorMessage => true,
|
|
42
|
+
:errorTitle => '',
|
|
43
|
+
:error => 'Only values from C1:C8',
|
|
44
|
+
:errorStyle => :stop,
|
|
45
|
+
:showInputMessage => true,
|
|
46
|
+
:promptTitle => '',
|
|
47
|
+
:prompt => 'Only values from C1:C8'})
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
p.serialize 'data_validation.xlsx'
|