summaryrefslogtreecommitdiff
path: root/source/text/scalc/01
diff options
context:
space:
mode:
authorRafael Lima <rafael.palma.lima@gmail.com>2023-01-10 19:42:50 +0000
committerOlivier Hallot <olivier.hallot@libreoffice.org>2023-01-11 00:09:58 +0000
commit20d4c17ca1fb161bf5fccf3d94db93b0a4d322f2 (patch)
treec9f2703d3b9790e9e724b3ba9c8d943bca3699fa /source/text/scalc/01
parent08418f863745757cc8074db7addf4812170dc21b (diff)
tdf#152412 Improve the STYLE function help page
This patch creates a separate help page for the STYLE function and improves its text and examples. Change-Id: I3630fbc99ac822ea138f08283e92d88ffa4acaf8 Reviewed-on: https://gerrit.libreoffice.org/c/help/+/145299 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Olivier Hallot <olivier.hallot@libreoffice.org>
Diffstat (limited to 'source/text/scalc/01')
-rw-r--r--source/text/scalc/01/04060104.xhp2
-rw-r--r--source/text/scalc/01/04060109.xhp36
-rw-r--r--source/text/scalc/01/func_style.xhp73
3 files changed, 81 insertions, 30 deletions
diff --git a/source/text/scalc/01/04060104.xhp b/source/text/scalc/01/04060104.xhp
index d2b2f01014..65e0076dab 100644
--- a/source/text/scalc/01/04060104.xhp
+++ b/source/text/scalc/01/04060104.xhp
@@ -207,8 +207,10 @@
<bookmark_value>CURRENT function</bookmark_value>
</bookmark>
<bookmark xml-lang="en-US" branch="hid/SC_HID_FUNC_AKTUELL" id="bm_id3145295" localize="false"/>
+<section id="func_current_description">
<h2 id="hd_id3155625" xml-lang="en-US">CURRENT</h2>
<paragraph id="par_id3157975" role="paragraph" xml-lang="en-US"><ahelp hid="HID_FUNC_AKTUELL">This function returns the result to date of evaluating the formula of which it is a part (in other words the result as far as that evaluation has got). Its main use is together with the STYLE() function to apply selected styles to a cell depending on the cell contents.</ahelp></paragraph>
+</section>
<embed href="text/scalc/01/common_func.xhp#sectionsyntax"/>
<paragraph id="par_id3150930" role="code" xml-lang="en-US">CURRENT()</paragraph>
<embed href="text/scalc/01/common_func.xhp#sectionexample"/>
diff --git a/source/text/scalc/01/04060109.xhp b/source/text/scalc/01/04060109.xhp
index e1ab74ace9..1e6d28d8e0 100644
--- a/source/text/scalc/01/04060109.xhp
+++ b/source/text/scalc/01/04060109.xhp
@@ -410,36 +410,12 @@
<paragraph xml-lang="en-US" id="par_id3149809" role="paragraph">
<item type="input">=LOOKUP(A1;D1:D100;F1:F100)</item> searches the corresponding cell in range D1:D100 for the number you entered in A1. For the instance found, the index is determined, for example, the 12th cell in this range. Then, the contents of the 12th cell are returned as the value of the function (in the result vector).</paragraph>
</section>
- <section id="Section15">
-<bookmark xml-lang="en-US" branch="index" id="bm_id3149425"><bookmark_value>STYLE function</bookmark_value>
-</bookmark>
-<bookmark xml-lang="en-US" branch="hid/SC_HID_FUNC_VORLAGE" id="bm_id3154342" localize="false"/>
-<h2 id="hd_id3149425">STYLE</h2>
- <paragraph xml-lang="en-US" id="par_id3150826" role="paragraph"><ahelp hid="HID_FUNC_VORLAGE">Applies a style to the cell containing the formula.</ahelp> After a set amount of time, another style can be applied. This function always returns the value 0, allowing you to add it to another function without changing the value. Together with the CURRENT function you can apply a color to a cell depending on the value. For example: =...+STYLE(IF(CURRENT()&gt;3;"red";"green")) applies the style "red" to the cell if the value is greater than 3, otherwise the style "green" is applied. Both cell formats, "red" and "green" have to be defined beforehand.</paragraph>
- <note id="par_id1670450904">The STYLE function should not be used without a compelling reason. Its purpose is the use with asynchronous Add-In functions to visually notify about the availability of a result. In almost all other cases, using conditional formatting instead is a better choice.</note>
- <embed href="text/scalc/01/common_func.xhp#sectionsyntax"/>
- <paragraph xml-lang="en-US" id="par_id3149302" role="code">STYLE("Style" [; Time [; "Style2"]])</paragraph>
- <paragraph xml-lang="en-US" id="par_id3150596" role="paragraph">
- <emph>Style</emph> is the name of a cell style assigned to the cell. Style names must be entered in quotation marks.</paragraph>
- <paragraph xml-lang="en-US" id="par_id3156149" role="paragraph">
- <emph>Time</emph> is an optional time range in seconds. If this parameter is missing the style will not be changed after a certain amount of time has passed.</paragraph>
- <paragraph xml-lang="en-US" id="par_id3149520" role="paragraph">
- <emph>Style2</emph> is the optional name of a cell style assigned to the cell after a certain amount of time has passed. If this parameter is missing "Default" is assumed.</paragraph>
- <paragraph xml-lang="en-US" id="par_idN111CA" role="paragraph" localize="false">
- <embedvar href="text/scalc/00/00000004.xhp#optional"/>
- </paragraph>
- <embed href="text/scalc/01/common_func.xhp#sectionexample"/>
- <paragraph xml-lang="en-US" id="par_id3151374" role="paragraph">
- <item type="input">=STYLE("Invisible";60;"Default")</item> formats the cell in transparent format for 60 seconds after the document was recalculated or loaded, then the Default format is assigned. Both cell formats have to be defined beforehand.</paragraph>
- <paragraph xml-lang="en-US" id="par_id8056886" role="paragraph">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:</paragraph>
- <paragraph xml-lang="en-US" id="par_id3668935" role="paragraph">
- <item type="input">="Text"&amp;T(STYLE("myStyle"))</item>
- </paragraph>
- <paragraph xml-lang="en-US" id="par_id3042085" role="paragraph">See also CURRENT() for another example.</paragraph>
- <embed href="text/scalc/01/common_func.xhp#sectiontechinfo"/>
- <embed href="text/scalc/01/common_func.xhp#notODFF"/>
- <paragraph role="paragraph" id="par_id311644873986703" localize="false"><literal>ORG.OPENOFFICE.STYLE</literal></paragraph>
- </section>
+
+<section id="Section15">
+ <h2 id="hd_id275141466812589" localize="false"><embedvar href="text/scalc/01/func_style.xhp#func_style_header"/></h2>
+ <paragraph id="par_id164731033512580" role="paragraph" localize="false"><embedvar href="text/scalc/01/func_style.xhp#func_style_desc"/></paragraph>
+</section>
+
<section id="Section16">
<bookmark xml-lang="en-US" branch="index" id="bm_id3150430"><bookmark_value>CHOOSE function</bookmark_value>
</bookmark>
diff --git a/source/text/scalc/01/func_style.xhp b/source/text/scalc/01/func_style.xhp
new file mode 100644
index 0000000000..7e1c168450
--- /dev/null
+++ b/source/text/scalc/01/func_style.xhp
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<helpdocument version="1.0">
+<!--
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+-->
+
+<meta>
+ <topic id="textscalc01func_style">
+ <title id="tit" xml-lang="en-US">STYLE function</title>
+ <filename>/text/scalc/01/func_style.xhp</filename>
+ </topic>
+</meta>
+
+<body>
+ <section id="func_style_definition">
+ <bookmark xml-lang="en-US" branch="hid/SC_HID_FUNC_VORLAGE" id="bm_id3154342" localize="false"/>
+ <bookmark xml-lang="en-US" branch="index" id="bm_id346793467934121">
+ <bookmark_value>STYLE function</bookmark_value>
+ </bookmark>
+ <h2 id="hd_id321673374992325"><variable id="func_style_header"><link href="text/scalc/01/func_style.xhp">STYLE</link></variable> function</h2>
+ <paragraph role="paragraph" id="par_id441673375101757"><ahelp hid="HID_FUNC_VORLAGE"><variable id="func_style_desc">Applies a style to the cell containing the formula.</variable></ahelp> After a set amount of time, another style can be applied.</paragraph>
+ </section>
+ <paragraph role="paragraph" id="par_id681673375365338">This function always returns the numeric value 0, which allows to use it by adding the <emph>STYLE</emph> function to other functions in the same cell without changing its value.</paragraph>
+
+ <embed href="text/scalc/01/common_func.xhp#sectionsyntax"/>
+ <paragraph role="paragraph" id="par_id961673376106137">
+ <input>STYLE("Style" [; Time [; "Style2"]])</input>
+ </paragraph>
+ <paragraph role="paragraph" id="par_id31673375542211">
+ <emph>Style</emph> is the name of the cell style to be applied to the cell. Style names are not case-sensitive and must be entered in quotation marks.
+ </paragraph>
+ <paragraph role="paragraph" id="par_id161673375589532">
+ <emph>Time</emph> is an optional time range in seconds. After this time is ellapsed, the style defined in <emph>Style2</emph> is applied. Leave this parameter blank if you do not want the style to be changed.
+ </paragraph>
+ <paragraph role="paragraph" id="par_id81673375703156">
+ <emph>Style2</emph> is the optional name of a cell style assigned to the cell after the time specified in the <emph>Time</emph> parameter has passed. If this parameter is missing the "Default" cell style is applied.
+ </paragraph>
+ <note id="par_id971673376620554"><embedvar href="text/scalc/00/00000004.xhp#optional"/></note>
+
+ <embed href="text/scalc/01/common_func.xhp#sectionexample"/>
+ <paragraph role="paragraph" id="par_id491673376748686">
+ <input>=10+STYLE("Good",60,"Neutral")</input>
+ </paragraph>
+ <paragraph role="paragraph" id="par_id11673376842469">Enters the value 10 into the cell and applies the style named "Good". After 60 seconds, the style "Neutral" is applied.</paragraph>
+
+ <paragraph role="paragraph" id="par_id271673376901358">
+ <input>=A1*A2+STYLE(IF(CURRENT()&lt;100,"Bad","Good"))</input>
+ </paragraph>
+ <paragraph role="paragraph" id="par_id1001673377339392">Enters the result of multiplying the values in cells A1 and A2 and applies the style "Bad" if the result is less than 100, otherwie the style "Good" is applied. Here the function <emph>CURRENT()</emph> is used to get the currently evaluated value of the function in the cell.</paragraph>
+
+ <paragraph role="paragraph" id="par_id761673377678426">
+ <input>="Total"&amp;T(STYLE("Result"))</input>
+ </paragraph>
+ <paragraph role="paragraph" id="par_id871673377683120">Enters the text "Total" into the cell and applies the style named "Result". Note that this example deals with textual values, hence the output of the <emph>STYLE</emph> funcion needs to be appended to the text using the &amp; operator. The function <emph>T()</emph> is used to prevent the number "0" being appended to the resulting text.</paragraph>
+
+ <embed href="text/scalc/01/common_func.xhp#sectiontechinfo"/>
+ <embed href="text/scalc/01/common_func.xhp#notODFF"/>
+ <paragraph role="paragraph" id="par_id311644873986703" localize="false"><literal>ORG.OPENOFFICE.STYLE</literal></paragraph>
+
+ <section id="relatedtopics">
+ <paragraph role="paragraph" id="par_id631673379195650"><link href="text/scalc/01/04060109.xhp">Spreadsheet Functions</link></paragraph>
+ <paragraph role="paragraph" id="par_id151673379420755"><link href="text/scalc/guide/cellstyle_by_formula.xhp">Assigning Formats by Formula</link></paragraph>
+ <paragraph role="paragraph" id="par_id461673376361959"><link href="text/scalc/01/04060104.xhp#func_current_description">CURRENT function</link></paragraph>
+ <paragraph role="paragraph" id="par_id381673378944042"><link href="text/scalc/01/04060110.xhp#t">T function</link></paragraph>
+ </section>
+
+</body>
+</helpdocument>