Sha256: e1b7ae74cdf253238b44a9ce02f97d3c5ac2a8abcfb6df03935e6cf1d1f6fdde

Contents?: true

Size: 717 Bytes

Versions: 1

Compression:

Stored size: 717 Bytes

Contents

require 'axlsx'
package = Axlsx::Package.new
workbook = package.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 }

  wb.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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
axlsx-1.2.3 examples/sprk2012/styles.rb