summaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/README.md2
-rw-r--r--examples/basic_formula_example.md2
-rw-r--r--examples/cached_formula_example.md2
-rw-r--r--examples/column_outlines_example.md2
-rw-r--r--examples/complex_example.md2
-rw-r--r--examples/defined_name_example.md2
-rw-r--r--examples/images/sort_state_example_1.pngbin0 -> 62716 bytes
-rw-r--r--examples/images/sort_state_example_2.pngbin0 -> 64787 bytes
-rw-r--r--examples/row_outlines_example.md2
-rw-r--r--examples/sort_state_example.md42
10 files changed, 55 insertions, 1 deletions
diff --git a/examples/README.md b/examples/README.md
index ea76d376..b43da2bb 100644
--- a/examples/README.md
+++ b/examples/README.md
@@ -49,7 +49,7 @@ Types:
Customizations:
* [Chart colors](chart_colors_example.md)
* [Hide gridlines](hide_gridlines_in_chart_example.md)
-* [Chart series color](chart_series_example.md)
+* [Chart series color](chart_series_color_example.md)
### Columns
diff --git a/examples/basic_formula_example.md b/examples/basic_formula_example.md
index d19288fb..5a6eb878 100644
--- a/examples/basic_formula_example.md
+++ b/examples/basic_formula_example.md
@@ -7,6 +7,8 @@ You could insert formulas
```ruby
require 'axlsx'
+Axlsx.escape_formulas = false
+
p = Axlsx::Package.new
wb = p.workbook
diff --git a/examples/cached_formula_example.md b/examples/cached_formula_example.md
index e5b82264..47855b59 100644
--- a/examples/cached_formula_example.md
+++ b/examples/cached_formula_example.md
@@ -7,6 +7,8 @@ When you add a formula in Excel, it immediately calculates its value and store i
```ruby
require 'axlsx'
+Axlsx.escape_formulas = false
+
p = Axlsx::Package.new
wb = p.workbook
diff --git a/examples/column_outlines_example.md b/examples/column_outlines_example.md
index 6d402af5..5e2557e4 100644
--- a/examples/column_outlines_example.md
+++ b/examples/column_outlines_example.md
@@ -7,6 +7,8 @@ If you have a list of data that you want to group and summarize, you can create
```ruby
require 'axlsx'
+Axlsx.escape_formulas = false
+
p = Axlsx::Package.new
wb = p.workbook
diff --git a/examples/complex_example.md b/examples/complex_example.md
index 4f395b02..c0c8d7f4 100644
--- a/examples/complex_example.md
+++ b/examples/complex_example.md
@@ -7,6 +7,8 @@ This is a complex example with a worksheet full of data.
```ruby
require 'axlsx'
+Axlsx.escape_formulas = false
+
p = Axlsx::Package.new
wb = p.workbook
diff --git a/examples/defined_name_example.md b/examples/defined_name_example.md
index ce998263..b2dd3a80 100644
--- a/examples/defined_name_example.md
+++ b/examples/defined_name_example.md
@@ -7,6 +7,8 @@ You could use defined names in formulas
```ruby
require 'axlsx'
+Axlsx.escape_formulas = false
+
p = Axlsx::Package.new
wb = p.workbook
diff --git a/examples/images/sort_state_example_1.png b/examples/images/sort_state_example_1.png
new file mode 100644
index 00000000..fb13d387
--- /dev/null
+++ b/examples/images/sort_state_example_1.png
Binary files differ
diff --git a/examples/images/sort_state_example_2.png b/examples/images/sort_state_example_2.png
new file mode 100644
index 00000000..c84b6848
--- /dev/null
+++ b/examples/images/sort_state_example_2.png
Binary files differ
diff --git a/examples/row_outlines_example.md b/examples/row_outlines_example.md
index baa48cfe..78c0d55a 100644
--- a/examples/row_outlines_example.md
+++ b/examples/row_outlines_example.md
@@ -7,6 +7,8 @@ If you have a list of data that you want to group and summarize, you can create
```ruby
require 'axlsx'
+Axlsx.escape_formulas = false
+
p = Axlsx::Package.new
wb = p.workbook
diff --git a/examples/sort_state_example.md b/examples/sort_state_example.md
new file mode 100644
index 00000000..d0258c31
--- /dev/null
+++ b/examples/sort_state_example.md
@@ -0,0 +1,42 @@
+## Description
+
+You could add sort conditions to the sort state of an auto filtered table
+
+## Code
+
+```ruby
+require 'axlsx'
+
+p = Axlsx::Package.new
+wb = p.workbook
+
+wb.add_worksheet(name: 'Sort State') do |sheet|
+ sheet.add_row ['Number', 'Letter', 'Priority']
+ sheet.add_row [1, 'B', 'high']
+ sheet.add_row [2, 'B', 'low']
+ sheet.add_row [3, 'B', 'medium']
+ sheet.add_row [4, 'B', 'high']
+ sheet.add_row [5, 'B', 'low']
+ sheet.add_row [6, 'B', 'medium']
+ sheet.add_row [7, 'A', 'high']
+ sheet.add_row [8, 'A', 'low']
+ sheet.add_row [9, 'A', 'medium']
+ sheet.add_row [10, 'A', 'high']
+ sheet.add_row [11, 'A', 'low']
+ sheet.add_row [12, 'A', 'medium']
+ sheet.auto_filter = 'A1:C13'
+ sheet.auto_filter.sort_state.add_sort_condition column_index: 1
+ sheet.auto_filter.sort_state.add_sort_condition column_index: 2, custom_list: ['low', 'medium', 'high']
+ sheet.auto_filter.sort_state.add_sort_condition column_index: 0, order: :desc
+end
+
+p.serialize 'sort_state_example.xlsx'
+```
+
+## Output
+
+![Output](images/sort_state_example_1.png "Output")
+
+After adding the sort conditions:
+
+![Output](images/sort_state_example_2.png "Output")