Module: FastExcel::WorkbookExt

Includes:
AttributeHelper
Defined in:
lib/fast_excel.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from AttributeHelper

#fields_hash, #pretty_print, #set

Instance Attribute Details

#filenameObject

Returns the value of attribute filename.



322
323
324
# File 'lib/fast_excel.rb', line 322

def filename
  @filename
end

#is_openObject

Returns the value of attribute is_open.



322
323
324
# File 'lib/fast_excel.rb', line 322

def is_open
  @is_open
end

#tmp_fileObject

Returns the value of attribute tmp_file.



322
323
324
# File 'lib/fast_excel.rb', line 322

def tmp_file
  @tmp_file
end

Instance Method Details

#add_format(options = nil) ⇒ Object



329
330
331
332
333
# File 'lib/fast_excel.rb', line 329

def add_format(options = nil)
  new_format = super()
  new_format.set(options) if options
  new_format
end

#add_worksheet(sheetname = nil) ⇒ Object



349
350
351
352
353
# File 'lib/fast_excel.rb', line 349

def add_worksheet(sheetname = nil)
  sheet = super
  sheet.workbook = self
  sheet
end

#bold_cell_formatObject



335
336
337
338
339
# File 'lib/fast_excel.rb', line 335

def bold_cell_format
  bold = add_format
  bold.set_bold
  bold
end

#closeObject



355
356
357
358
# File 'lib/fast_excel.rb', line 355

def close
  @is_open = false
  super
end

#constant_memory?Boolean

Returns:

  • (Boolean)


371
372
373
374
# File 'lib/fast_excel.rb', line 371

def constant_memory?
  #FastExcel.print_ffi_obj(self[:options])
  @constant_memory ||= self[:options][:constant_memory] != 0
end

#initialize(struct) ⇒ Object



324
325
326
327
# File 'lib/fast_excel.rb', line 324

def initialize(struct)
  @is_open = true
  super(struct)
end

#number_format(pattern) ⇒ Object

“#,##0.00” “[$-409]m/d/yy h:mm AM/PM;@”



343
344
345
346
347
# File 'lib/fast_excel.rb', line 343

def number_format(pattern)
  format = add_format
  format.set_num_format(pattern)
  format
end

#read_stringObject



360
361
362
363
364
365
# File 'lib/fast_excel.rb', line 360

def read_string
  close if @is_open
  File.open(filename, 'rb', &:read)
ensure
  remove_tmp_file
end

#remove_tmp_fileObject



367
368
369
# File 'lib/fast_excel.rb', line 367

def remove_tmp_file
  File.delete(filename) if tmp_file
end