simple_xlsx_reader
simple_xlsx_reader copied to clipboard
need skip type casting
some cell is needed original string.
in my case cell data is floating number(currency style), type is nil, but style is fixnum. this case cell data is casting to integer.
optional skip type casting(not shared string) will be useful another case. how do you think about this?
Conceptualizing excel formatting without examples hurts my brain, could you include an example spreadsheet or a screenshot?
Skipping type casting is interesting. Currently, type casting is a static method since it's a functionally pure problem (same inputs always equal the same outputs), and I could change it to be configurable so you could supply your own typecasting method? Then you could implement yours as a no-op, or call to the default type caster and do post-processing, etc.
Sorry can't regenerate problem.
here is some screenshot. this screenshot case data cast to String, but sometimes cast number. i think it's depends on cell style.
Maybe skipping type cast like this
module SimpleXlsxReader
class Document
class Mapper
def self.cast(value, type, style, options = {})
return nil if value.nil? || value.empty?
case type
when 's' # shared string
options[:shared_strings][value.to_i]
else
value
end
end
end
end
end