ExcelAction export not using integerFormat

The standard ExcelAction for excel export is not using the integerFormat locale settings.
It’s also not using the NumberFormat added to the column.

Example(working in table):

Not working in Excel for data type = Long:

I think the same can be done for Long/Integer like the issue below? The issue only fixed BigDecimal formatting.

I have tried to set the numberFormat in entity and also a global numberFormat for locale.

core\messages.properties + web\messages.properties

integerFormat=0 

Entity:

...
public class Order extends StandardEntity {
    private static final long serialVersionUID = -4415564416336435977L;

    @NumberFormat(pattern = "####,###0.00##") // working in table + excel for BigDecimal
    @NotNull
    @Column(name = "AMOUNT", nullable = false)
    protected BigDecimal amount;

    @NumberFormat(pattern = "0") // NOT working in Excel for Long/Integer. Table is ok.
    @NotNull
    @Column(name = "REFERENCE_NO", nullable = false)
    protected Long referenceNo;
...

Sample project to reproduce (using platform version 7.08):
ExcelFormat.zip (97.4 KB)

Hi!

CUBA provides default styles in the ExcelExporter#createFormats() for formating values in Excel. You can override this behaviour and use it in your action.
The main idea of the given issue was to use the same numbers count after dicmal separator that was defined in the NumberFormat pattern. It does not fully apply number format for decimal values.

I have created an issue for getting value patterns from locales: cuba-platform/cuba#2476. It to be discussed. You can vote for this issue so we can see that this feature is very needful.

1 Like

Thanks. I will try the override for now.
I think for the user experience the Excel export data should be formatted the same as the table data on screen.