Class: CSVPlusPlus::Modifier::RubyXLModifier

Inherits:
Modifier
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/csv_plus_plus/modifier/rubyxl_modifier.rb

Overview

Build a RubyXL-decorated Modifier class adds some support for Excel

Instance Attribute Summary

Attributes inherited from Modifier

#bordercolor, #borders, #borderstyle, #color, #expand, #fontcolor, #fontfamily, #fontsize, #formats, #halign, #note, #numberformat, #row_level, #validate, #valign, #var

Instance Method Summary collapse

Methods inherited from Modifier

#any_border?, #border=, #border_all?, #border_along?, #cell_level?, #format=, #formatted?, #freeze!, #frozen?, #infinite_expand!, #initialize, #row_level!, #row_level?, #take_defaults_from!

Constructor Details

This class inherits a constructor from CSVPlusPlus::Modifier::Modifier

Instance Method Details

#border_weight::String?

The excel-specific border weight

Returns:

  • (::String, nil)


47
48
49
50
51
# File 'lib/csv_plus_plus/modifier/rubyxl_modifier.rb', line 47

def border_weight
  # rubocop:disable Lint/ConstantResolution
  BORDER_STYLES[borderstyle]
  # rubocop:enable Lint/ConstantResolution
end

#horizontal_alignment::String?

The horizontal alignment, formatted for the RubyXL API

Returns:

  • (::String, nil)


57
58
59
# File 'lib/csv_plus_plus/modifier/rubyxl_modifier.rb', line 57

def horizontal_alignment
  @halign&.serialize
end

#number_format_code::String

The excel-specific number format code

Returns:

  • (::String)


65
66
67
68
69
70
71
72
73
# File 'lib/csv_plus_plus/modifier/rubyxl_modifier.rb', line 65

def number_format_code
  return unless @numberformat

  ::RubyXL::NumberFormats::DEFAULT_NUMBER_FORMATS.find_by_format_id(
    # rubocop:disable Lint/ConstantResolution
    NUM_FMT_IDS[@numberformat]
    # rubocop:enable Lint/ConstantResolution
  ).format_code
end

#vertical_alignment::String?

The vertical alignment, formatted for the RubyXL API

Returns:

  • (::String, nil)


79
80
81
# File 'lib/csv_plus_plus/modifier/rubyxl_modifier.rb', line 79

def vertical_alignment
  @valign&.serialize
end