diff options
| author | Randy Morgan <[email protected]> | 2013-09-10 10:08:00 +0900 |
|---|---|---|
| committer | Randy Morgan <[email protected]> | 2013-09-13 00:08:39 +0900 |
| commit | 2067c6940fc3a7ef1e8398474ac2c862130504ce (patch) | |
| tree | 0740f40483727e8bdba858831bb550e8b8b9fe50 /examples/example.rb | |
| parent | 877a38dc528b0c579ca753af6354796d0d572cdd (diff) | |
| download | caxlsx-2067c6940fc3a7ef1e8398474ac2c862130504ce.tar.gz caxlsx-2067c6940fc3a7ef1e8398474ac2c862130504ce.zip | |
Page Breaks - round one
This sets up the basic col and row break creation and serialization.
You can specify either a string reference like "C7" or provide an
Axlsx::Cell instance to specify the break point.
Serialization is working cleanly but excel does not automatically
render those breaks yet. You need to switch to page preview mode.
Diffstat (limited to 'examples/example.rb')
| -rwxr-xr-x | examples/example.rb | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/examples/example.rb b/examples/example.rb index 218237a6..17e67411 100755 --- a/examples/example.rb +++ b/examples/example.rb @@ -46,6 +46,8 @@ examples << :streaming examples << :shared_strings examples << :no_autowidth examples << :cached_formula +examples << :page_breaks + p = Axlsx::Package.new wb = p.workbook #``` @@ -278,12 +280,11 @@ if examples.include? :images img = File.expand_path('../image1.jpeg', __FILE__) # specifying the :hyperlink option will add a hyper link to your image. # @note - Numbers does not support this part of the specification. - sheet.add_image(:image_src => img, :noSelect => true, end_at: true, :noMove => true, :hyperlink=>"http://axlsx.blogspot.com") do |image| + sheet.add_image(:image_src => img, :noSelect => true, :noMove => true, :hyperlink=>"http://axlsx.blogspot.com") do |image| image.width=720 image.height=666 image.hyperlink.tooltip = "Labeled Link" image.start_at 2, 2 - image.end_at 200, 200 end end end @@ -643,6 +644,7 @@ if examples.include? :sheet_view end end + # conditional formatting # if examples.include? :conditional_formatting @@ -713,7 +715,17 @@ if examples.include? :conditional_formatting end end -##Validate and Serialize +# Page Breaks +if examples.include? :page_breaks + ws = wb.add_worksheet(:name => "page breaks") do |sheet| + sheet.add_row ["A"] * 10 + sheet.add_row ["A"] * 10 + sheet.add_page_break("A2") + sheet.add_page_break(sheet.rows.last.cells[5]) + end +end + +#Validate and Serialize #```ruby # Serialize directly to file |
