Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
349 views
in Technique[技术] by (71.8m points)

Rails [AXLSX]: Change Currency

I need to change the currency format on an Excel file that is exported. The default currency pattern is US (1,000.00) [One Thousand] and I need it to become PT-BR format (1.000,00) [One Thousand].

I have tried implementing this way:

    formated = workbook.styles.add_style(format_code: '$#.##0,00')

but the only thing it did, was add more zeroes after the .

How should I do it?

question from:https://stackoverflow.com/questions/65617686/rails-axlsx-change-currency

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Welcome to SO :)

Yo might try this:

formated = workbook.styles.add_style(:format_code => '#.###,##')

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

56.9k users

...