Class: SequencescapeExcel::Worksheet::RangesWorksheet

Inherits:
Base
  • Object
show all
Defined in:
app/sequencescape_excel/sequencescape_excel/worksheet/ranges_worksheet.rb

Overview

Ranges worksheet

Instance Attribute Summary

Attributes inherited from Base

#axlsx_worksheet, #columns, #name, #password, #ranges, #workbook

Instance Method Summary collapse

Methods inherited from Base

#add_row, #add_rows, #initialize, #insert_axlsx_worksheet, #protect

Constructor Details

This class inherits a constructor from SequencescapeExcel::Worksheet::Base

Instance Method Details

#add_rangesObject

Adds ranges on the worksheet. One range one row.


22
23
24
25
# File 'app/sequencescape_excel/sequencescape_excel/worksheet/ranges_worksheet.rb', line 22

def add_ranges
  ranges.each { |_k, range| add_row range.options }
  self
end

#create_worksheetObject

Using axlsx worksheet creates worksheet with all the ranges listed on worksheet. Also updates ranges with absolute reference (adds worksheet name to ranges references, i.e. 'Ranges!$A$5:$F$5'), so that the ranges could be passed in and used in data worksheet (data validations and conditional formattings use ranges absolute references in formulas).


14
15
16
17
18
# File 'app/sequencescape_excel/sequencescape_excel/worksheet/ranges_worksheet.rb', line 14

def create_worksheet
  super
  add_ranges
  ranges.set_worksheet_names(name)
end