Module: SequencescapeExcel::Helpers::Worksheet

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]
    }
  }
}.freeze

Instance Method Summary collapse

Instance Method Details

#add_headersObject


33
34
35
# File 'app/sequencescape_excel/sequencescape_excel/helpers/worksheet.rb', line 33

def add_headers
  add_row columns.headings, styles[:wrap_text].reference
end

#create_stylesObject


46
47
48
# File 'app/sequencescape_excel/sequencescape_excel/helpers/worksheet.rb', line 46

def create_styles
  styles.tap { |s| STYLES.each { |k, style| s[k] = Style.new(workbook, style) } }
end

#first_rowObject

The row where the table with data starts (after headings)


38
39
40
# File 'app/sequencescape_excel/sequencescape_excel/helpers/worksheet.rb', line 38

def first_row
  10
end

#stylesObject


42
43
44
# File 'app/sequencescape_excel/sequencescape_excel/helpers/worksheet.rb', line 42

def styles
  @styles ||= {}
end