Sha256: c6b26e38d0c7c05544d595d7a0f1bb23e88f5f673a08165c2b5528e623130dd9

Contents?: true

Size: 1.03 KB

Versions: 8

Compression:

Stored size: 1.03 KB

Contents

require 'examples/example_workbook'

# $ bundle exec ruby examples/layout.rb

ExampleWorkbook.new("layout") do

  worksheet('first') {

    #  | A | B | C | D |
    # 1| x | x | x | x |
    # 2|   x   | x | x |
    # 3| x |       | x |
    # 4| x |   x   | x |
    # 5| x |       | x |

    4.times { column }

    # row 1: one cell per column
    row {
      4.times do |i|
        cell(:index => i+1) { data "x" }
      end
    }

    # row 2: first cell colspan=2
    row {
      cell(:index => 1, :merge_across => 1) { data "x" }
      2.times do |i|
        cell(:index => i+3) { data "x" }
      end
    }

    # row 3,4,5: more complex merging
    # => row 3
    row {
      cell(:index => 1) { data "x" }
      cell(:index => 2, :merge_across => 1, :merge_down => 2) { data "x" }
      cell(:index => 4) { data "x" }
    }

    # => row 4
    row {
      cell(:index => 1) { data "x" }
      cell(:index => 4) { data "x" }
    }

    # => row 5
    row {
      cell(:index => 1) { data "x" }
      cell(:index => 4) { data "x" }
    }

  }

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
xmlss-1.0.1 examples/layout.rb
xmlss-1.0.0 examples/layout.rb
xmlss-1.0.0.rc.4 examples/layout.rb
xmlss-1.0.0.rc.3 examples/layout.rb
xmlss-1.0.0.rc.2 examples/layout.rb
xmlss-1.0.0.rc.1 examples/layout.rb
xmlss-0.4.1 examples/layout.rb
xmlss-0.4.0 examples/layout.rb