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-0.85.11 examples/update_range_format_with_params.rb