Sha256: d94ffd0f6670b32c311c0c201c0566c4f8ada25f346e177e8c31c289907ee790

Contents?: true

Size: 902 Bytes

Versions: 9

Compression:

Stored size: 902 Bytes

Contents

#!/usr/bin/env ruby
# -*- coding: utf-8 -*-

#######################################################################
#
# A simple example of how to use the write_xlsx gem to
# update format of the range of cells.
#

require 'write_xlsx'

workbook = WriteXLSX.new('update_range_format_with_params.xlsx')
worksheet = workbook.add_worksheet

common_format = workbook.add_format(align: 'center', border: 1)

table_contents = [
  %w[Table Header Contents],
  %w[table body contents],
  %w[table body contents],
  %w[table body contents]
]

worksheet.write_col(0, 0, table_contents, common_format)
worksheet.update_range_format_with_params(
  0, 0, 0, 2,
  bold: 1, top: 2, bottom: 2, bg_color: 31
)
worksheet.update_range_format_with_params(0, 0, 3, 0, left: 2)
worksheet.update_range_format_with_params(0, 2, 3, 2, right: 2)
worksheet.update_range_format_with_params(3, 0, 3, 2, bottom: 2)

workbook.close

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
write_xlsx-1.12.1 examples/update_range_format_with_params.rb
write_xlsx-1.12.0 examples/update_range_format_with_params.rb
write_xlsx-1.11.2 examples/update_range_format_with_params.rb
write_xlsx-1.11.1 examples/update_range_format_with_params.rb
write_xlsx-1.11.0 examples/update_range_format_with_params.rb
write_xlsx-1.10.2 examples/update_range_format_with_params.rb
write_xlsx-1.10.1 examples/update_range_format_with_params.rb
write_xlsx-1.10.0 examples/update_range_format_with_params.rb
write_xlsx-1.09.5 examples/update_range_format_with_params.rb