Bug 158502 - Can't have added text before format codes with NatNum modifier
Summary: Can't have added text before format codes with NatNum modifier
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.5.2.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Calc-Cells
  Show dependency treegraph
 
Reported: 2023-12-03 16:54 UTC by Octavio Alvarez
Modified: 2023-12-05 06:06 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Octavio Alvarez 2023-12-03 16:54:56 UTC
Description:
It seems like the NatNumX modifiers can only appear at the beginning of the format string. Format strings like \"0.00\" or "TOTAL IS"0 work fine, but the number in that position can't be modified by a NatNumX modifier. Text added after, seems to work well, though.

Steps to Reproduce:
1. Create a new Calc document.
2. Set A1 to 1.
2. Set the A1's number format to: "TOTAL IS "[NatNum12 upper cardinal]0 


Actual Results:
Format is not recognized, as evidenced in the preview window, and no action is taken if applied.

Expected Results:
A1 should appear as "TOTAL IS ONE".


Reproducible: Always


User Profile Reset: No

Additional Info:
Version: 7.6.2.1 (X86_64) / LibreOffice Community
Build ID: 56f7684011345957bbf33a7ee678afaf4d2ba333
CPU threads: 8; OS: Linux 6.2; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded

I didn't tried resetting my profile but multiple people tested and confirmed this in the LibreOffice-ES Telegram group.
Comment 1 Octavio Alvarez 2023-12-03 16:56:17 UTC
By the way, the documentation does not specify any needed order. It appears that this should work fine.
Comment 2 gmolleda 2023-12-03 17:42:47 UTC
Same behaviour in 7.5.2.2 (x86_64)
Comment 3 elmau 2023-12-03 17:53:31 UTC
Same behaviour in:

Version: 7.6.3.2 (X86_64) / LibreOffice Community
Build ID: 60(Build:2)
CPU threads: 16; OS: Linux 6.6; UI render: default; VCL: gtk3
Locale: es-MX (en_US.UTF-8); UI: en-US
7.6.3-2
Calc: threaded
Comment 4 gmolleda 2023-12-03 18:35:49 UTC
In the version LibreOffice 3.3.0 OOO330m19 (Build:6) not exist this enhancement.
Comment 5 elmau 2023-12-03 18:41:03 UTC
yes, it was introduced in 6.1:

https://wiki.documentfoundation.org/ReleaseNotes/6.1#Localization
Comment 6 ady 2023-12-03 19:50:53 UTC
Quote (I'm adding asterisks to emphasize):

"
To display numbers using native number characters, use a [NatNum1], [NatNum2], ..., [NatNum11] modifier at the **beginning** of a number format codes.
"

Source:

https://help.libreoffice.org/7.6/en-US/text/shared/01/05020301.html

So, according to that, this report would not be a bug.

I don't know whether this requirement could be changed in the future. I doubt it.

For assistance on possible workarounds, I would suggest going to <https://ask.libreoffice.org> and asking there if needed.
Comment 7 ady 2023-12-03 20:03:04 UTC
As a hint, you might want to try something like (replace NatNum3 with the format you are interested):

[NatNum3]"Total:" 0
Comment 8 m_a_riosv 2023-12-03 21:51:43 UTC
(In reply to ady from comment #7)
> As a hint, you might want to try something like (replace NatNum3 with the
> format you are interested):
> 
> [NatNum3]"Total:" 10

That doesn't work, the result is:
Total: 10
instead of the text of the number
Total: ten
But the reported issue is how to add double quote " with [NatNum12]:
[NatNum12]\"15\"  => "150", but should be: "one hundred fifty"

It works in other cases (seems when there are specified parameters):
[NatNum12 D=ordinal]\"D MMM\"
shows
"first Dec"
for a date in the cell 1/12/2023
Comment 9 ady 2023-12-03 22:10:47 UTC
(In reply to m.a.riosv from comment #8)
> (In reply to ady from comment #7)
> > As a hint, you might want to try something like (replace NatNum3 with the
> > format you are interested):
> > 
> > [NatNum3]"Total:" 10
> 
> That doesn't work, the result is:

I did not provide a solution, just a hint; and I admit I might be completely wrong about it. Using an auxiliary cell with a concatenate formula might help, maybe (or maybe not). I don't know the real requirements for the particular case either.

Now, whether any hint and/or potential workarounds work as users need (or not) is not the point of this bug report. The report is about using [NatNumX] (with "X" being a valid number for the format) in some position in the number format other than the initial/start of the code. The answer is that it is not supposed to work in any other position, only at the start of the code.

Anything else should be discussed elsewhere, and the report (as presented in comment 0) should be NAB.
Comment 10 m_a_riosv 2023-12-03 22:15:47 UTC
In my samples, it is just after the [NatNum12], not at the beginning of the format.
Comment 11 ady 2023-12-03 22:31:59 UTC
@Miguel,

Please refer to comment 6, as an answer to the description in comment 0.

If there is anything else related to NatNum that is really not working as it should, I would suggest opening a new report and to describe it more clearly, including steps and/or a sample.
Comment 12 elmau 2023-12-03 23:39:40 UTC
I think the report is clear enough from the beginning.
Comment 13 Octavio Alvarez 2023-12-04 20:42:53 UTC
(In reply to ady from comment #6)
> Quote (I'm adding asterisks to emphasize):
> 
> "
> To display numbers using native number characters, use a [NatNum1],
> [NatNum2], ..., [NatNum11] modifier at the **beginning** of a number format
> codes.
> "
> 
> Source:
> 
> https://help.libreoffice.org/7.6/en-US/text/shared/01/05020301.html
> 
> So, according to that, this report would not be a bug.

Good point. However, it also says: "To include text in a number format that is applied to a cell containing numbers, place a double quotation mark (") in front of and behind the text, or a backslash (\) before a single character." There is no limitation as to where additional texts may be located and it works for \"0,00\".

Added text and modifiers work separately and the expectation from a user point of view is that they should work combined.
Comment 14 ady 2023-12-04 21:44:52 UTC
(In reply to Octavio Alvarez from comment #13)

> it also says: "To include text in a number format that
> is applied to a cell containing numbers, place a double quotation mark (")
> in front of and behind the text, or a backslash (\) before a single
> character." There is no limitation as to where additional texts may be
> located and it works for \"0,00\".
> 
> Added text and modifiers work separately and the expectation from a user
> point of view is that they should work combined.

The description in comment 0 and the Summary field in this report are focused on the location of the [NatNumX] code within the number format code field. In order to effectively bring the developers' attention to the problem of combining additional text with the [NatNumX] code within the number format code, my suggestion is to open a new bug report, in which the focus is on a clear and concise example, simple and clear steps to reproduce, and even a sample ods document. IMHO, such new report would be more effective than leaving this report in place, which contains inaccurate claims, mixed info and vague examples. Whichever the case, I hope the situation gets somehow improved.
Comment 15 Octavio Alvarez 2023-12-05 03:52:19 UTC
I updated the issue subject from:

> Native numbering: NatNumX modifier can't appear anywhere in the format string

to

> Can't have added text before format codes with NatNum modifier

I removed the "Native numbering" prefix to avoid assuming that the problem lies there. Hope this helps clear it up.
Comment 16 Octavio Alvarez 2023-12-05 03:58:08 UTC
BTW, an additional piece of data: we tried the following without luck:

> Cell value: 1
> Cell format code: [NatNum12 upper cardinal]"abc"0

Result: abc1
Comment 17 ady 2023-12-05 06:06:57 UTC
(In reply to Octavio Alvarez from comment #16)
> BTW, an additional piece of data: we tried the following without luck:
> 
> > Cell value: 1
> > Cell format code: [NatNum12 upper cardinal]"abc"0
> 
> Result: abc1

FWIW...

I tried:
Cell format:
[NatNum1][$-411]"Total: "0

and, at least initially, it worked as expected (e.g. when the cell value is 123.456 then the cell shows "Total: 一二三" without quotation marks).

Reopening the number format code window, the code in the window box itself would be different, but the format is saved as user-defined format.

Please also remember that not every combination of codes (Extended LCID, [$-NNCCLLLL]) is currently supported.

Perhaps the [NatNum12] variant doesn't support additional text (other than the already supported options). But even then, that is not how this bug report was initially framed.

As I said before, it would be better to have this kind of discussions at the ask.lo.org forum, where a specific request can be first discussed and evaluated by several different users, before coming here to clearly and succinctly describe a bug or an enhancement request.