summaryrefslogtreecommitdiffhomepage
path: root/examples/example.rb
diff options
context:
space:
mode:
authorRandy Morgan <[email protected]>2013-09-29 13:18:23 +0900
committerRandy Morgan <[email protected]>2013-09-29 13:18:23 +0900
commit09c9170e50ed4550015e34fdb54b7433bee0ef40 (patch)
tree173692234de961c220b7086dcaf70c09fa9d0348 /examples/example.rb
parent2d604bd4a7463d6f248e103f24246e53973c71aa (diff)
downloadcaxlsx-09c9170e50ed4550015e34fdb54b7433bee0ef40.tar.gz
caxlsx-09c9170e50ed4550015e34fdb54b7433bee0ef40.zip
Adds examples for hiding sheets and workbook view
These examples show using hidden and very hidden to manage worksheet visibility as well as using the active_tab attribute of a workbook#view in order to specify which tab should be showing when the sheet is opened.
Diffstat (limited to 'examples/example.rb')
-rwxr-xr-xexamples/example.rb23
1 files changed, 22 insertions, 1 deletions
diff --git a/examples/example.rb b/examples/example.rb
index 4960ce9f..8b11cb20 100755
--- a/examples/example.rb
+++ b/examples/example.rb
@@ -40,14 +40,15 @@ examples << :printing
examples << :header_footer
examples << :comments
examples << :panes
+examples << :book_view
examples << :sheet_view
+examples << :hiding_sheets
examples << :conditional_formatting
examples << :streaming
examples << :shared_strings
examples << :no_autowidth
examples << :cached_formula
examples << :page_breaks
-
p = Axlsx::Package.new
wb = p.workbook
#```
@@ -644,7 +645,27 @@ if examples.include? :sheet_view
end
end
+## Book Views
+#
+## Book views let you specify which sheet the show as active when the user opens the work book as well as a bunch of other
+## tuning values for the UI @see Axlsx::WorkbookView
+## ```ruby
+if examples.include? :book_view
+ # when you open example.xml the second sheet is selected, and the horizontal scroll bar is much smaller showing more sheets
+ wb.add_view tab_ratio: 800, active_tab: 1
+end
+## Hiding Sheets
+##
+## Sheets can be hidden with the state attribute
+if examples.include? :hiding_sheets
+ wb.add_worksheet name: 'hidden', state: :hidden do |sheet|
+ sheet.add_row ['you cant see me!']
+ end
+ wb.add_worksheet name: 'very hidden', state: :very_hidden do |sheet|
+ sheet.add_row ['you really cant see me!']
+ end
+end
# conditional formatting
#
if examples.include? :conditional_formatting