Class: Writexlsx::Format::FormatState

Inherits:
Object
  • Object
show all
Defined in:
lib/write_xlsx/format/format_state.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeFormatState

Returns a new instance of FormatState.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/write_xlsx/format/format_state.rb', line 15

def initialize
  @fill          = FillState.new
  @border        = BorderState.new
  @font          = FontState.new
  @alignment     = AlignmentState.new
  @protection    = ProtectionState.new
  @number_format = NumberFormatState.new

  @xf_index       = nil
  @dxf_index      = nil
  @xf_id          = 0

  @quote_prefix   = 0
  @has_fill       = false
  @has_font       = false
  @has_border     = false
  @has_dxf_fill   = false
  @has_dxf_font   = false
  @has_dxf_border = false
  @dxf_fg_color   = nil
  @dxf_bg_color   = nil

  @used_as_dxf    = false
end

Instance Attribute Details

#alignmentObject

Returns the value of attribute alignment.



7
8
9
# File 'lib/write_xlsx/format/format_state.rb', line 7

def alignment
  @alignment
end

#borderObject

Returns the value of attribute border.



7
8
9
# File 'lib/write_xlsx/format/format_state.rb', line 7

def border
  @border
end

#dxf_bg_colorObject

Returns the value of attribute dxf_bg_color.



12
13
14
# File 'lib/write_xlsx/format/format_state.rb', line 12

def dxf_bg_color
  @dxf_bg_color
end

#dxf_fg_colorObject

Returns the value of attribute dxf_fg_color.



12
13
14
# File 'lib/write_xlsx/format/format_state.rb', line 12

def dxf_fg_color
  @dxf_fg_color
end

#dxf_indexObject

Returns the value of attribute dxf_index.



8
9
10
# File 'lib/write_xlsx/format/format_state.rb', line 8

def dxf_index
  @dxf_index
end

#fillObject

Returns the value of attribute fill.



7
8
9
# File 'lib/write_xlsx/format/format_state.rb', line 7

def fill
  @fill
end

#fontObject

Returns the value of attribute font.



7
8
9
# File 'lib/write_xlsx/format/format_state.rb', line 7

def font
  @font
end

#has_borderObject

Returns the value of attribute has_border.



10
11
12
# File 'lib/write_xlsx/format/format_state.rb', line 10

def has_border
  @has_border
end

#has_dxf_borderObject

Returns the value of attribute has_dxf_border.



11
12
13
# File 'lib/write_xlsx/format/format_state.rb', line 11

def has_dxf_border
  @has_dxf_border
end

#has_dxf_fillObject

Returns the value of attribute has_dxf_fill.



11
12
13
# File 'lib/write_xlsx/format/format_state.rb', line 11

def has_dxf_fill
  @has_dxf_fill
end

#has_dxf_fontObject

Returns the value of attribute has_dxf_font.



11
12
13
# File 'lib/write_xlsx/format/format_state.rb', line 11

def has_dxf_font
  @has_dxf_font
end

#has_fillObject

Returns the value of attribute has_fill.



10
11
12
# File 'lib/write_xlsx/format/format_state.rb', line 10

def has_fill
  @has_fill
end

#has_fontObject

Returns the value of attribute has_font.



10
11
12
# File 'lib/write_xlsx/format/format_state.rb', line 10

def has_font
  @has_font
end

#number_formatObject

Returns the value of attribute number_format.



7
8
9
# File 'lib/write_xlsx/format/format_state.rb', line 7

def number_format
  @number_format
end

#protectionObject

Returns the value of attribute protection.



7
8
9
# File 'lib/write_xlsx/format/format_state.rb', line 7

def protection
  @protection
end

#quote_prefixObject

Returns the value of attribute quote_prefix.



9
10
11
# File 'lib/write_xlsx/format/format_state.rb', line 9

def quote_prefix
  @quote_prefix
end

#used_as_dxfObject

Returns the value of attribute used_as_dxf.



13
14
15
# File 'lib/write_xlsx/format/format_state.rb', line 13

def used_as_dxf
  @used_as_dxf
end

#xf_idObject

Returns the value of attribute xf_id.



8
9
10
# File 'lib/write_xlsx/format/format_state.rb', line 8

def xf_id
  @xf_id
end

#xf_indexObject

Returns the value of attribute xf_index.



8
9
10
# File 'lib/write_xlsx/format/format_state.rb', line 8

def xf_index
  @xf_index
end

Instance Method Details

#initialize_copy(other) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/write_xlsx/format/format_state.rb', line 40

def initialize_copy(other)
  @fill          = other.fill&.dup
  @border        = other.border&.dup
  @font          = other.font&.dup
  @alignment     = other.alignment&.dup
  @protection    = other.protection&.dup
  @number_format = other.number_format&.dup

  @xf_index       = nil
  @dxf_index      = nil
  @xf_id          = other.xf_id
  @quote_prefix   = other.quote_prefix
  @has_fill       = false
  @has_font       = false
  @has_border     = false
  @has_dxf_fill   = false
  @has_dxf_font   = false
  @has_dxf_border = false
  @dxf_fg_color   = other.dxf_fg_color
  @dxf_bg_color   = other.dxf_bg_color

  @used_as_dxf    = other.used_as_dxf
end