Module: AxlsxEnhanced::Helpers::Styles

Defined in:
lib/axlsx_enhanced/helpers/styles/style.rb,
lib/axlsx_enhanced/helpers/styles/defaults.rb,
lib/axlsx_enhanced/helpers/styles/style_collection.rb

Defined Under Namespace

Classes: Style, StyleCollection

Class Method Summary collapse

Class Method Details

.defaultsObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/axlsx_enhanced/helpers/styles/defaults.rb', line 4

def self.defaults
  return [
    # Text style
    { name: :bold,            properties: { b: true } },
    { name: :italic,          properties: { i: true } },
    { name: :underline,       properties: { u: true } },
    { name: :strike,          properties: { strike: true } },
  
    # Horizontal alignment
    { name: :halign_left,     properties: { alignment: { horizontal: :left   } } },
    { name: :halign_center,   properties: { alignment: { horizontal: :center } } },
    { name: :halign_right,    properties: { alignment: { horizontal: :right  } } },
  
    # Vertical alignment
    { name: :valign_top,      properties: { alignment: { vertial: :top    } } },
    { name: :valign_center,   properties: { alignment: { vertial: :center } } },
    { name: :valign_right,    properties: { alignment: { vertial: :bottom } } },
    { name: :wrap_text,       properties: { alignment: { wrap_text: true  } } },
  
    # Borders
    { name: :border_top_1,    properties: { border: { style: :thin,   color: 'FF000000', edges: [:top, :bottom, :left, :right] } } },
    { name: :border_top_2,    properties: { border: { style: :medium, color: 'FF000000', edges: [:top, :bottom, :left, :right] } } },
  
    # Number formats
    {
      name: :number, properties: {
        format_code: '#,##0.00'
      }
    },
    {
      name: :int_number, properties: {
        format_code: '#,##0'
      }
    },
  
    # Date formats
    {
      name: :date, properties: {
        format_code: 'DD/MM/YYYY'
      }
    },
  
    # Text colors
    {
      name: :red_text, properties: {
        fg_color: 'FF0000'
      }
    },
  
    # Custom presets
    {
      name: :report_title, properties: {
        sz: 14,
        b: true,
        alignment: { vertical: :center, horizontal: :center },
        height: 30
      }
    },
    {
      name: :report_subtitle, properties: {
        sz: 12,
        b: true,
        alignment: { vertical: :center, horizontal: :center },
        height: 20
      }
    },
    { 
      name: :table_header, properties: {
        b: true, 
        alignment: { vertical: :center, horizontal: :center }, 
        height: 20,
        bg_color: '2196F3', fg_color: 'FF'
      }
    },
    {
      name: :table_footer, properties: {
        b: true,
        alignment: { vertical: :center, horizontal: :center },
        height: 20,
        bg_color: '2196F3', fg_color: 'FF'
      }
    }
  ]
end