Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spreadsheet: Incorrect number formatting in formula - locale and precision is lost #5731

Closed
bwajtr opened this issue Nov 16, 2023 · 2 comments · Fixed by #6208 or #6655
Closed

Spreadsheet: Incorrect number formatting in formula - locale and precision is lost #5731

bwajtr opened this issue Nov 16, 2023 · 2 comments · Fixed by #6208 or #6655

Comments

@bwajtr
Copy link
Contributor

bwajtr commented Nov 16, 2023

Description

When you enter a number with lots of digits to the cell, then the actual value of the number is truncated by CellValueManager.EXCEL_FORMULA_BAR_DECIMAL_FORMAT. That is very similar behavior as in Excel 2019, where the number is trucated so it has 16 digits (entering =0,123456789012345678 to a cell in Excel 2019 turns into =0,123456789012345 in the formula bar).

This behavior works correctly in Spreadsheet only when you enter a plain number to a cell (as shown in the first part of the video). Once you enter the number as a formula (with a leading =), then strange things start to happen. The value in the cell is displayed correctly, but when you go to the formula bar then:

  1. The number is truncated to only three decimal places in the formula bar. So the precision is lost - you cannot edit the original number!
  2. Select the cell and go to another sheet, then return back -> suddenly, the number in the formula bar has the original precision, but it's not formatted using the current UI locale!

See it on this video:

Screen.Recording.2023-11-16.at.10.49.20.mov

Expected outcome

I'd expect numbers, that are part of formulas, to be always formatted using the current UI locale and I'd expect, that the numbers in the formula bar show maximum possible precision - regardless of whether they are part of a formula or not

Minimal reproducible example

See the behavior on the attached video

Steps to reproduce

See the behavior on the attached video

Environment

Vaadin version(s): 24.3
OS: MacOs
Not browser related

Browsers

No response

@ugur-vaadin
Copy link
Contributor

This can be broken down into two separate issues:

  • formula bar displaying the number using the wrong locale when the cell is selected using the address field
  • the formula field displaying a truncated number when the number is set using a formula (=...)

There is a PR that should fix the first issue. The second one is still unsolved.

@ugur-vaadin
Copy link
Contributor

ugur-vaadin commented Sep 11, 2024

This can be broken down into two separate issues:

  • formula bar displaying the number using the wrong locale when the cell is selected using the address field
  • the formula field displaying a truncated number when the number is set using a formula (=...)

There is a PR that should fix the first issue. The second one is still unsolved.

The second issue should still be addressed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment