Sha256: c76d9e190617c331f09d3aa889f9d22e696ede5c3c1e7859ef4765f63c5a25a1

Contents?: true

Size: 921 Bytes

Versions: 9

Compression:

Stored size: 921 Bytes

Contents

require_relative '../lib/fast_excel'

workbook = FastExcel.open("example_colors.xlsx", constant_memory: true)

worksheet = workbook.add_worksheet

color_format = workbook.add_format

# We can use color names as string and symbols, color hex codes and color hex numbers

color_format.set(
  font_color: '9900FF',
  bg_color: '#FFAAAA',

  border_bottom: :medium,
  border_bottom_color: 'green',

  border_left: :slant_dash_dot,
  border_left_color: 0x00FF00,

  border_right: :double,
  border_right_color: :crimson,

  border_top: :border_hair,
  border_top_color: :medium_blue
)

# Possible border styles:
# [:none, :thin, :medium, :dashed, :dotted, :thick, :double, :hair, :medium_dashed,
#  :dash_dot, :medium_dash_dot, :dash_dot_dot, :medium_dash_dot_dot, :slant_dash_dot]

worksheet.set_column_width(1, 30)

worksheet.write_value(1, 1, "Hello", color_format)

workbook.close
puts "Saved to file example_colors.xlsx"

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
fast_excel-0.5.0 examples/example_colors.rb
fast_excel-0.4.1 examples/example_colors.rb
fast_excel-0.4.0 examples/example_colors.rb
fast_excel-0.3.0 examples/example_colors.rb
fast_excel-0.2.6 examples/example_colors.rb
fast_excel-0.2.5 examples/example_colors.rb
fast_excel-0.2.3 examples/example_colors.rb
fast_excel-0.2.2 examples/example_colors.rb
kmadej_fast_excel_fork-0.2.2 examples/example_colors.rb