Module: FastExcel::WorkbookExt

Includes:
AttributeHelper
Defined in:
lib/fast_excel.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from AttributeHelper

#pretty_print, #set

Instance Attribute Details

#filenameObject

Returns the value of attribute filename.



124
125
126
# File 'lib/fast_excel.rb', line 124

def filename
  @filename
end

#is_openObject

Returns the value of attribute is_open.



124
125
126
# File 'lib/fast_excel.rb', line 124

def is_open
  @is_open
end

#tmp_fileObject

Returns the value of attribute tmp_file.



124
125
126
# File 'lib/fast_excel.rb', line 124

def tmp_file
  @tmp_file
end

Instance Method Details

#add_worksheet(sheetname = nil) ⇒ Object



145
146
147
# File 'lib/fast_excel.rb', line 145

def add_worksheet(sheetname = nil)
  super
end

#bold_cell_formatObject



131
132
133
134
135
# File 'lib/fast_excel.rb', line 131

def bold_cell_format
  bold = add_format
  bold.set_bold
  bold
end

#closeObject



149
150
151
152
# File 'lib/fast_excel.rb', line 149

def close
  @is_open = false
  super
end

#initialize(struct) ⇒ Object



126
127
128
129
# File 'lib/fast_excel.rb', line 126

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

#number_format(pattern) ⇒ Object

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



139
140
141
142
143
# File 'lib/fast_excel.rb', line 139

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

#read_stringObject



154
155
156
157
158
159
# File 'lib/fast_excel.rb', line 154

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

#remove_tmp_fileObject



161
162
163
# File 'lib/fast_excel.rb', line 161

def remove_tmp_file
  File.delete(filename) if tmp_file
end