Sha256: f1dc209aeb22260516a9ad310aa4c35d924b3dc52eebb1cde5f7f854ea192d8b

Contents?: true

Size: 837 Bytes

Versions: 3

Compression:

Stored size: 837 Bytes

Contents

$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../../lib"

require 'axlsx'
package = Axlsx::Package.new
package.workbook do |workbook|
  workbook.styles do |s|
    black_cell = s.add_style :bg_color => "00", :fg_color => "FF", :sz => 14, :alignment => { :horizontal=> :center }
    blue_cell =  s.add_style  :bg_color => "0000FF", :fg_color => "FF", :sz => 20, :alignment => { :horizontal=> :center }

    workbook.add_worksheet(:name => "Styles") do |sheet|
      # Applies the black_cell style to the first and third cell, and the blue_cell style to the second.
      sheet.add_row ["Text Autowidth", "Second", "Third"], :style => [black_cell, blue_cell, black_cell]

      # Applies the thin border to all three cells
      sheet.add_row [1, 2, 3], :style => Axlsx::STYLE_THIN_BORDER
    end
  end
end
package.serialize 'styles.xlsx'

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
axlsx-1.3.3 examples/sprk2012/styles.rb
axlsx-1.3.2 examples/sprk2012/styles.rb
axlsx-1.3.1 examples/sprk2012/styles.rb