Module: SequencescapeExcel::Helpers::Worksheet
- Included in:
 - BulkSubmissionExcel::Worksheet::DataWorksheet, SampleManifestExcel::Worksheet::DataWorksheet, SampleManifestExcel::Worksheet::TestWorksheet
 
- Defined in:
 - app/sequencescape_excel/sequencescape_excel/helpers/worksheet.rb
 
Overview
Add the basic styles which are the same across all worksheets.
Defined Under Namespace
Classes: Style
Constant Summary collapse
- STYLES =
 { unlocked: { locked: false, border: { style: :thin, color: '00' } }, unlocked_no_border: { locked: false }, wrap_text: { alignment: { horizontal: :center, vertical: :center, wrap_text: true }, border: { style: :thin, color: '00', edges: %i[left right top bottom] } }, string: { format_code: '@' # Text field }, integer: { format_code: '#' # Numeric field (Integer) }, disabled: { locked: true, border: { style: :thin, color: '00' }, bg_color: 'd3d3d3' } }.freeze
Instance Method Summary collapse
- #add_headers ⇒ Object
 - #create_styles ⇒ Object
 - #find_or_create_style(components) ⇒ Object
 - 
  
    
      #first_row  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
The row where the table with data starts (after headings).
 - #styles ⇒ Object
 
Instance Method Details
#add_headers ⇒ Object
      47 48 49  | 
    
      # File 'app/sequencescape_excel/sequencescape_excel/helpers/worksheet.rb', line 47 def add_headers add_row columns.headings, styles[:wrap_text].reference end  | 
  
#create_styles ⇒ Object
      64 65 66  | 
    
      # File 'app/sequencescape_excel/sequencescape_excel/helpers/worksheet.rb', line 64 def create_styles styles.tap { |s| STYLES.each { |k, style| s[k] = Style.new(workbook, style) } } end  | 
  
#find_or_create_style(components) ⇒ Object
      60 61 62  | 
    
      # File 'app/sequencescape_excel/sequencescape_excel/helpers/worksheet.rb', line 60 def find_or_create_style(components) styles[components] ||= generate_style(components) end  | 
  
#first_row ⇒ Object
The row where the table with data starts (after headings)
      52 53 54  | 
    
      # File 'app/sequencescape_excel/sequencescape_excel/helpers/worksheet.rb', line 52 def first_row 10 end  | 
  
#styles ⇒ Object
      56 57 58  | 
    
      # File 'app/sequencescape_excel/sequencescape_excel/helpers/worksheet.rb', line 56 def styles @styles ||= {} end  |