diff options
| author | Randy Morgan <[email protected]> | 2011-12-08 10:33:38 +0900 |
|---|---|---|
| committer | Randy Morgan <[email protected]> | 2011-12-08 10:33:38 +0900 |
| commit | 4791367ceaee648f6c1e712bf0ab827271529b1b (patch) | |
| tree | 6614d339ce2c1977e0ca9efe14595b3c66279b18 /examples | |
| parent | 4ba478ebba7dc54ef05579d021200561cecf2987 (diff) | |
| download | caxlsx-4791367ceaee648f6c1e712bf0ab827271529b1b.tar.gz caxlsx-4791367ceaee648f6c1e712bf0ab827271529b1b.zip | |
adding in support for merged cells
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/example.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/examples/example.rb b/examples/example.rb index 4bc9bf23..b92fbb29 100644 --- a/examples/example.rb +++ b/examples/example.rb @@ -200,5 +200,22 @@ if ARGV.size==0 || ARGV.include?("13") end +#Merging Cells. +if ARGV.size==0 || ARGV.include?("14") + p = Axlsx::Package.new + p.workbook.add_worksheet(:name=>'My Worksheet') do |sheet| + # cell level style overides when adding cells + sheet.add_row ['col 1', 'col 2', 'col 3', 'col 4'], :sz => 16 + sheet.add_row [1, 2, 3, "=SUM(A2:C2)"] + sheet.add_row [2, 3, 4, "=SUM(A3:C3)"] + sheet.add_row ["total", "", "", "=SUM(D2:D3)"] + sheet.merge_cells('A1:B4') + sheet["A1:D1"].each { |c| c.color = "FF0000"} + end + p.workbook['My Worksheet!A1:D4'].each { |c| c.style = Axlsx::STYLE_THIN_BORDER } + p.serialize("example14.xlsx") + +end + |
