Sha256: e44ec8233419d95416e613ec3ef94cea6460d075c052ad26c5cf5cc494803c72

Contents?: true

Size: 855 Bytes

Versions: 1

Compression:

Stored size: 855 Bytes

Contents

#!/usr/bin/env ruby

#######################################################################
#
# An example of adding a worksheet watermark image using the WriteXLSX
# rubygem. This is based on the method of putting an image in the worksheet
# header as suggested in the Microsoft documentation:
# https://support.microsoft.com/en-us/office/add-a-watermark-in-excel-a372182a-d733-484e-825c-18ddf3edf009
#
# Copyright 2000-2023, John McNamara, jmcnamara@cpan.org
# convert to ruby by Hideo NAKAMURA, nakamura.hideo@gmail.com
#

require 'write_xlsx'

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

# Set a worksheet header with the watermark image.
dirname = File.dirname(File.expand_path(__FILE__))
worksheet.set_header(
  '&C&C&[Picture]', nil,
  { :image_center => File.join(dirname, 'watermark.png') }
)

workbook.close

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
write_xlsx-1.10.0 examples/watermark.rb