Sha256: c4f9ba90a78801e447635ac66699c5386178ab42ebec4b29ad8baabc0e700f94

Contents?: true

Size: 926 Bytes

Versions: 21

Compression:

Stored size: 926 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 = [
  ['Table', 'Header', 'Contents'],
  ['table', 'body', 'contents'],
  ['table', 'body', 'contents'],
  ['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

21 entries across 21 versions & 1 rubygems

Version Path
write_xlsx-1.09.4 examples/update_range_format_with_params.rb
write_xlsx-1.09.3 examples/update_range_format_with_params.rb
write_xlsx-1.09.2 examples/update_range_format_with_params.rb
write_xlsx-1.09.1 examples/update_range_format_with_params.rb
write_xlsx-1.09.0 examples/update_range_format_with_params.rb
write_xlsx-1.08.2 examples/update_range_format_with_params.rb
write_xlsx-1.08.1 examples/update_range_format_with_params.rb
write_xlsx-1.08.0 examples/update_range_format_with_params.rb
write_xlsx-1.07.0 examples/update_range_format_with_params.rb
write_xlsx-1.04.0 examples/update_range_format_with_params.rb
write_xlsx-1.02.0 examples/update_range_format_with_params.rb
write_xlsx-1.01.0 examples/update_range_format_with_params.rb
write_xlsx-1.00.0 examples/update_range_format_with_params.rb
write_xlsx-0.99.0 examples/update_range_format_with_params.rb
write_xlsx-0.97.0 examples/update_range_format_with_params.rb
write_xlsx-0.90.0 examples/update_range_format_with_params.rb
write_xlsx-0.89.0 examples/update_range_format_with_params.rb
write_xlsx-0.88.0 examples/update_range_format_with_params.rb
write_xlsx-0.87.0 examples/update_range_format_with_params.rb
write_xlsx-0.86.0 examples/update_range_format_with_params.rb