https://bugs.documentfoundation.org/show_bug.cgi?id=152412

            Bug ID: 152412
           Summary: STYLE spreadsheet function help: a phrase that refers
                    to unknown context
           Product: LibreOffice
           Version: unspecified
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Documentation
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]

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

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to