diff options
| author | Zsolt Kozaroczy <[email protected]> | 2020-09-11 00:36:29 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-09-11 00:36:29 +0200 |
| commit | 282eec44ef01746ee25931fa6cd287ad083fd40b (patch) | |
| tree | 14504bf429ca264812679ca971c1592853d3f762 /examples/data_validation.rb | |
| parent | 317e8244e4d17c394c1e181f86df3974623fb865 (diff) | |
| download | caxlsx-282eec44ef01746ee25931fa6cd287ad083fd40b.tar.gz caxlsx-282eec44ef01746ee25931fa6cd287ad083fd40b.zip | |
Restructure examples folder (#47)
Split examples into separate markdown files, each containing a description, sample code, and a screenshot of the resulting xlsx document.
The script `generate.rb` is provided to actually generate the example documents by executing the sample code contained in the markdown files.
Diffstat (limited to 'examples/data_validation.rb')
| -rw-r--r-- | examples/data_validation.rb | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/examples/data_validation.rb b/examples/data_validation.rb deleted file mode 100644 index b95a6397..00000000 --- a/examples/data_validation.rb +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env ruby -w -s -# -*- coding: utf-8 -*- -$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../lib" -require 'axlsx' - -p = Axlsx::Package.new -p.workbook.add_worksheet do |ws| - - ws.add_row ["between", "lessThan", "bound list", "raw list"] - - 4.times do |i| - ws.add_row [nil, nil, nil, nil, (i+1) * 2] - end - - ws.add_data_validation("A2:A5", { - :type => :whole, - :operator => :between, - :formula1 => '5', - :formula2 => '10', - :showErrorMessage => true, - :errorTitle => 'Wrong input', - :error => 'Only values between 5 and 10', - :errorStyle => :information, - :showInputMessage => true, - :promptTitle => 'Be careful!', - :prompt => %{We really want a value between 5 and 10, -but it is OK if you want to break the rules. -}}) - - ws.add_data_validation("B1:B5", { - :type => :textLength, - :operator => :lessThan, - :formula1 => '10', - :showErrorMessage => true, - :errorTitle => 'Text is too long', - :error => 'Max text length is 10 characters', - :errorStyle => :stop, - :showInputMessage => true, - :promptTitle => 'Text length', - :prompt => 'Max text length is 10 characters'}) - - ws.add_data_validation("C2:C5", { - :type => :list, - :formula1 => 'E2:E5', - :showDropDown => false, - :showErrorMessage => true, - :errorTitle => '', - :error => 'Only values from E2:E5', - :errorStyle => :stop, - :showInputMessage => true, - :promptTitle => '', - :prompt => 'Only values from E2:E5'}) - - ws.add_data_validation("D2:D5", { - :type => :list, - :formula1 => '"Red, Orange, NavyBlue"', - :showDropDown => false, - :showErrorMessage => true, - :errorTitle => '', - :error => 'Please use the dropdown selector to choose the value', - :errorStyle => :stop, - :showInputMessage => true, - :prompt => '& Choose the value from the dropdown'}) - -end - -p.serialize 'data_validation.xlsx' |
