Method: TableSetting::Sheet#css_styles

Defined in:
lib/table_setting/sheet.rb

#css_stylesObject



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/table_setting/sheet.rb', line 69

def css_styles
  signatures = {}
  cells.each do |cell|
    next if signatures[cell.style_name]
    signatures[cell.style_name] = cell.style_css
  end
  # .grid-sheet td {background-color: #fff;}
  # .grid-sheet tr:nth-child(odd) td {background-color: #eee;}
  # .grid-sheet .bold {font-weight: bold;}
  css = "    .grid-sheet {background-color: #ddd; border-collapse: separate; border-spacing: 1px;}\n    .grid-sheet td {background-color: #fff;}\n  CSS\n  signatures.each do |signature_class, signature_css|\n    next if signature_css.empty?\n    css += \"\\n.grid-sheet td.\#{signature_class} {\#{signature_css}}\"\n  end\n  css\nend\n"