Sha256: 03c28e6bbb5536c3721b690c0edb1ad2cd38ecfaacf657f26f742b5f5bec8a51

Contents?: true

Size: 979 Bytes

Versions: 27

Compression:

Stored size: 979 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, cxn03651@msj.biglobe.ne.jp
#

require 'rubygems'
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

27 entries across 27 versions & 1 rubygems

Version Path
write_xlsx-0.81.0 examples/hide_row_col.rb
write_xlsx-0.80.0 examples/hide_row_col.rb
write_xlsx-0.79.0 examples/hide_row_col.rb
write_xlsx-0.78.0 examples/hide_row_col.rb
write_xlsx-0.77.2 examples/hide_row_col.rb
write_xlsx-0.77.1 examples/hide_row_col.rb
write_xlsx-0.77.0 examples/hide_row_col.rb
write_xlsx-0.76.3 examples/hide_row_col.rb
write_xlsx-0.76.2 examples/hide_row_col.rb
write_xlsx-0.76.1 examples/hide_row_col.rb
write_xlsx-0.76.0 examples/hide_row_col.rb
write_xlsx-0.75.0 examples/hide_row_col.rb
write_xlsx-0.74.0 examples/hide_row_col.rb
write_xlsx-0.73.0 examples/hide_row_col.rb
write_xlsx-0.72.3.beta1 examples/hide_row_col.rb
write_xlsx-0.72.2 examples/hide_row_col.rb
write_xlsx-0.72.1 examples/hide_row_col.rb
write_xlsx-0.72.0 examples/hide_row_col.rb
write_xlsx-0.71.0 examples/hide_row_col.rb
write_xlsx-0.70.0 examples/hide_row_col.rb