On 21.05.2020 15:30, Marcin Wyrwalski wrote:
I would like to ask, if there is a possibility to set up constraint to not allow user to write more than three decimall places in cell? I preparing and sending file to user, and user is supposed to return file with some data. I would like to set up constraints on required field, to allow only good values. Has anybody have any ide it this can be done?
As far as I understand, this is impossible. The XLSX file has no means to limit the precision of numbers entered by the user. It only has means to limit the precision of displaying them. Note that software (at least MS Excel and LibreOffice Calc from my observations) considers any numbers entered into cells as IEEE 754 double precision numbers (with all related artifacts like rounding big integers).
Any rounding that needs to happen in your case will have to be handled by your spreadsheet parsing code. If you absolutely need to make sure the user cannot enter numbers that can't be represented as a DECIMAL(?, ?) type in your database, you should reconsider using the XLSX format as means for providing data by your user.
-- Tomasz Melcer --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
