Module: AxlsxEnhanced::Helpers::Injections::Workbook

Included in:
Axlsx::Workbook
Defined in:
lib/axlsx_enhanced/helpers/injections/workbook.rb

Instance Method Summary collapse

Instance Method Details

#smart_add_worksheet(options) {|worksheet| ... } ⇒ Object

Yields:

  • (worksheet)


5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/axlsx_enhanced/helpers/injections/workbook.rb', line 5

def smart_add_worksheet(options)
  # Create the worksheet
  worksheet = self.add_worksheet(options)
  
  # Assign smart styles if any is given, and clean options hash
  worksheet.smart_styles = options[:smart_styles] || AxlsxEnhanced::Helpers::Styles.defaults
  options.delete(:smart_styles)
      
  # Perform a block yield if necessary
  yield worksheet if block_given?
  worksheet
end