...
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)
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.
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.