Bug 152412 - STYLE spreadsheet function help: a phrase that refers to unknown context
Summary: STYLE spreadsheet function help: a phrase that refers to unknown context
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Documentation (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:7.6.0 target:24.2.0
Keywords:
Depends on:
Blocks:
 
Reported: 2022-12-07 12:57 UTC by Mike Kaganski
Modified: 2023-10-11 14:06 UTC (History)
2 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 Mike Kaganski 2022-12-07 12:57:00 UTC
STYLE function help [1] includes this phrase:

> Since STYLE() has a numeric return value of zero, this return value gets appended
> to a string. This can be avoided using T() as in the following example:

The phrase goes immediately after an example that does not append any strings, just uses a sole STYLE function in a simple formula. The following example deals with a complex formula case, when a user wants to use the formula to define a non-empty textual cell value, and at the same time, to set a specific style without affecting the displayed string content. The example uses STYLE inside T(), which returns an empty string, which does not modify the result when appended to the previous string.

So likely, the context was the discussion how to use the function in different scenarios; and in case of numeric expressions, like

  =A1*B2

when one wants to use the STYLE function in the same formula, the natural way is to *add* its return value (which is always 0):

  =A1+B2 + STYLE(...)      => shows the result of A1*B2+0, and assigns the style

... but this approach does not work with textual content: it will either convert it into a number, like in

  ="1" + STYLE(...)        => instead of text "1", the cell will have number 1

or will result in an error:

  ="ABC" + STYLE(...)      => #VALUE!

The intuitive solution seems to be using & instead of +:

  ="ABC" & STYLE(...)      => unwanted result: "ABC0"

... and now the problematic phrase in the help describes the correct solution.

[1] https://help.libreoffice.org/7.4/en-US/text/scalc/01/04060109.html?DbPAR=CALC#bm_id3149425
Comment 1 Rafael Lima 2023-01-10 18:11:47 UTC
Indeed the text and examples can be improved.

I'm setting this to NEW.
Comment 2 Rafael Lima 2023-01-10 19:47:46 UTC
I improved the text and examples in the help file.

Proposed patch available for review at:
https://gerrit.libreoffice.org/c/help/+/145299
Comment 3 Commit Notification 2023-01-11 00:10:04 UTC
Rafael Lima committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/help/commit/20d4c17ca1fb161bf5fccf3d94db93b0a4d322f2

tdf#152412 Improve the STYLE function help page
Comment 4 Commit Notification 2023-10-11 14:06:15 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/help/commit/379510d74d95dd4e7878e8e86401a3b60a6ef107

Follow-up: tdf#152412 Re-add the note to the STYLE() function