0

I'm writing a CSV file using the SuperCSV package. I'm writing my beans using CsvDozerBeanWriter. In my beans I have a BigInteger value and I want to write the csv file to a variable number of decimal places (It is 8 for now).

My CellProcessor looks like this:

     final CellProcessor[] processors = new CellProcessor[]{
                new Optional(),
                new ConvertNullTo("none"),
                new ConvertNullTo("none"),
                new ConvertNullTo("none"),
                new Optional(new FmtNumber("#####.########")), //doesn't do anything
                new Optional(),
                new Optional(),
                new Optional(),
        };

The value -118700000000 should be present in the csv as -1187.00000000.

Does anyone have an idea?

ceen
  • 25
  • 5

1 Answers1

0

-118700000000 is not the same value as -1187.00000000 (with the decimal point there, it would be written as -1187.0 x 108)

FmtNumber (and DecimalFormat which it uses to format the numbers) don't modify the value, only format it.

If you truly want to modify the value, you'll have to write your own processor.

James Bassett
  • 9,458
  • 4
  • 35
  • 68