Module: FastExcel::WorkbookExt
Instance Attribute Summary collapse
Instance Method Summary
collapse
#fields_hash, #pretty_print, #set
Instance Attribute Details
#filename ⇒ Object
Returns the value of attribute filename.
322
323
324
|
# File 'lib/fast_excel.rb', line 322
def filename
@filename
end
|
#is_open ⇒ Object
Returns the value of attribute is_open.
322
323
324
|
# File 'lib/fast_excel.rb', line 322
def is_open
@is_open
end
|
#tmp_file ⇒ Object
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
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
|
335
336
337
338
339
|
# File 'lib/fast_excel.rb', line 335
def bold_cell_format
bold = add_format
bold.set_bold
bold
end
|
#close ⇒ Object
355
356
357
358
|
# File 'lib/fast_excel.rb', line 355
def close
@is_open = false
super
end
|
#constant_memory? ⇒ Boolean
371
372
373
374
|
# File 'lib/fast_excel.rb', line 371
def constant_memory?
@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
|
“#,##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_string ⇒ Object
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_file ⇒ Object
367
368
369
|
# File 'lib/fast_excel.rb', line 367
def remove_tmp_file
File.delete(filename) if tmp_file
end
|