Skip to content

Commit

Permalink
Print zero with leading zero (as "0,00 €" instead of ",00 €")
Browse files Browse the repository at this point in the history
  • Loading branch information
andreas-mausch committed Jan 3, 2024
1 parent 932b902 commit 260d409
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/writers/ods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use Length::Mm;
use rusty_money::iso;
use spreadsheet_ods::{CellStyle, CellStyleRef, Length, Sheet, ValueFormatCurrency, ValueFormatText, WorkBook};
use spreadsheet_ods::condition::ValueCondition;
use spreadsheet_ods::format::{create_date_dmy_format, create_loc_currency_suffix, ValueFormatTrait, ValueStyleMap};
use spreadsheet_ods::format::{create_date_dmy_format, ValueFormatTrait, ValueStyleMap};

use crate::transaction::Transaction;
use crate::writers::Writer;
Expand All @@ -34,7 +34,18 @@ impl Ods {
}

fn create_currency_style(workbook: &mut WorkBook, locale: Locale) -> CellStyleRef {
let currency_format = create_loc_currency_suffix("currency_format", locale.clone(), locale.clone(), iso::EUR.symbol);
let mut currency_format = ValueFormatCurrency::new_localized("currency_format", locale.clone());
currency_format.part_number()
.min_integer_digits(1)
.decimal_places(2)
.min_decimal_places(2)
.grouping()
.build();
currency_format.part_text(" ").build();
currency_format.part_currency()
.locale(locale.clone())
.symbol(iso::EUR.symbol)
.build();
let currency_format = workbook.add_currency_format(currency_format);

let mut currency_format_negative = ValueFormatCurrency::new_localized("currency_format_negative", locale.clone());
Expand Down

0 comments on commit 260d409

Please sign in to comment.