Sha256: e9b6e8db68344418ca63e6016d2aeee10819a78c36d37fb39b0a5f4bb4a25254

Contents?: true

Size: 958 Bytes

Versions: 21

Compression:

Stored size: 958 Bytes

Contents

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

#######################################################################
#
# Example of how to hide rows and columns in Excel::Writer::XLSX. In order to
# hide rows without setting each one, (of approximately 1 million rows),
# Excel uses an optimisation to hide all rows that don't have data.
#
# reverse ('(c)'), December 2012, John McNamara, jmcnamara@cpan.org
# convert to ruby by Hideo NAKAMURA, nakamura.hideo@gmail.com
#

require 'write_xlsx'

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

# Write some data
worksheet.write('D1', 'Some hidden columns.')
worksheet.write('A8', 'Some hidden rows.')

# Hide all rows without data.
worksheet.set_default_row(nil, 1)

# Set emptys row that we do want to display. All other will be hidden.
(1..6).each { |row| worksheet.set_row(row, 15) }

# Hide a range of columns.
worksheet.set_column('G:XFD', nil, nil, 1)

workbook.close

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
write_xlsx-1.12.1 examples/hide_row_col.rb
write_xlsx-1.12.0 examples/hide_row_col.rb
write_xlsx-1.11.2 examples/hide_row_col.rb
write_xlsx-1.11.1 examples/hide_row_col.rb
write_xlsx-1.11.0 examples/hide_row_col.rb
write_xlsx-1.10.2 examples/hide_row_col.rb
write_xlsx-1.10.1 examples/hide_row_col.rb
write_xlsx-1.10.0 examples/hide_row_col.rb
write_xlsx-1.09.5 examples/hide_row_col.rb
write_xlsx-1.09.4 examples/hide_row_col.rb
write_xlsx-1.09.3 examples/hide_row_col.rb
write_xlsx-1.09.2 examples/hide_row_col.rb
write_xlsx-1.09.1 examples/hide_row_col.rb
write_xlsx-1.09.0 examples/hide_row_col.rb
write_xlsx-1.08.2 examples/hide_row_col.rb
write_xlsx-1.08.1 examples/hide_row_col.rb
write_xlsx-1.08.0 examples/hide_row_col.rb
write_xlsx-1.07.0 examples/hide_row_col.rb
write_xlsx-1.04.0 examples/hide_row_col.rb
write_xlsx-1.02.0 examples/hide_row_col.rb