I have Latitude/Longitude columns that I have given the number format of ###.###### in the data model. They show up correctly in the table but when I use the ExcelAction to export the table to excel I only get 4 decimal places instead of the 6 that are needed.
Is there something I can do to quickly fix this? Thoughts?
Please check the output documents. It should be the default Excel number format that prints only 4 decimal places. ExcelAction exports all data to XLS without additional formatting.
The output Excel documents only have four decimal places. If I format them in excel with six decimal numbers then decimals 5 and 6 are always zero.
I dug into the Cuba platform code and there is formatting happening at ExcelExporter.java line 699 for version 6.10.1 (str = datatype.format(n);). The datatype object here is BigDecimalDataType and it has a format pattern of 0.####. This is where I am losing my two decimal places. Is this a setting somewhere that I can set? Where is it getting this pattern? Thanks.
Unfortunately, for now I do not know how to change this behavior only for Excel export, but you can change decimal places number for entity attribute if you create custom datatype extending BigDecimalDatatype and use it in @MetaProperty annotation: Datatype - CUBA Platform. Developer’s Manual
This approach still doesn’t work as the Excel Export only uses the default datatype for the JavaClass. It has nothing to do with the settings against the column. I was able to get this to work though by creating my own data type and extending the AppMainWindow and explicitly setting it as the default type.