Sha256: 901ad58dd49ae1d216b7cccf458af0ab38b498981278fe118fdc704866e3b674

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 KB

Contents

require "rubygems"
require "surpass"

book = Workbook.new
ws = book.add_sheet

fmts = [
    'General',
    '0',
    '0.00',
    '#,##0',
    '#,##0.00',
    '"$"#,##0_);("$"#,##',
    '"$"#,##0_);[Red]("$"#,##',
    '"$"#,##0.00_);("$"#,##',
    '"$"#,##0.00_);[Red]("$"#,##',
    '0%',
    '0.00%',
    '0.00E+00',
    '# ?/?',
    '# ??/??',
    'M/D/YY',
    'D-MMM-YY',
    'D-MMM',
    'MMM-YY',
    'h:mm AM/PM',
    'h:mm:ss AM/PM',
    'h:mm',
    'h:mm:ss',
    'M/D/YY h:mm',
    '_(#,##0_);(#,##0)',
    '_(#,##0_);[Red](#,##0)',
    '_(#,##0.00_);(#,##0.00)',
    '_(#,##0.00_);[Red](#,##0.00)',
    '_("$"* #,##0_);_("$"* (#,##0);_("$"* "-"_);_(@_)',
    '_(* #,##0_);_(* (#,##0);_(* "-"_);_(@_)',
    '_("$"* #,##0.00_);_("$"* (#,##0.00);_("$"* "-"??_);_(@_)',
    '_(* #,##0.00_);_(* (#,##0.00);_(* "-"??_);_(@_)',
    'mm:ss',
    '[h]:mm:ss',
    'mm:ss.0',
    '##0.0E+0',
    '@'   
]

fmts.each_with_index do |fmt, i|
    ws.write(i, 0, fmt)

    style = StyleFormat.new
    style.number_format_string = fmt

    ws.write(i, 4, -1278.9078, style)
end

book.save(__FILE__.gsub(/rb$/, "xls"))

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
surpass-0.0.6 examples/num_formats.rb
surpass-0.0.3 examples/num_formats.rb