incubator-ooo-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tj ...@apache.org>
Subject Re: Display text if condition is true
Date Sat, 08 Sep 2012 11:40:22 GMT
On 9/8/2012 06:56, Hemant Kumar wrote:
> Hi,
>
> On 08-Sep-2012, at 3:41 PM, Rory O'Farrell <ofarrwrk@iol.ie> wrote:
>> There is a Conditional text mechanism.  The Help file says
>>
>> "Conditional Text
>> You can set up fields in your document that display text when a condition that you
define is met. For example, you can define the conditional text that is displayed in a series
of reminder letters.
>> Setting up conditional text in this example is a two-part process. First you create
a variable, and then you create the condition."
>
>
> Sure, but there is a problem with Conditional texts, which is - it requires a else condition.
Now, I don't want a else condition. To explain things further, I am building a OpenOffice
extension that allows switch case conditional text. For example:
>
> if editor EQ "emacs"
>   "Saint Ignatious"
> elsif editor EQ "vim"
>   "ahoy vim"
> elsif editor EQ "blah"
>    "blah
>
>
> Now, before I can build such an extension, Openoffice XML spec much support such a field.
The closest I found was, Conditional Text and hidden text. The problem with, Conditional text
is - it requires a else condition and problem with hidden field is, it does opposite of what
I want.
>
> For example, if Hidden text behaved such that, if condition specified is true, then show
the text else hide the text, my OpenOffice extension can generate following XML in the document:
>
> <text:hidden-text text:condition="ooow:editor EQ "emacs"" text:string-value="Sait
emacs" text:is-hidden="true">Wow man</text:hidden-text>
> <text:hidden-text text:condition="ooow:editor EQ "vim"" text:string-value="Saint vim"
text:is-hidden="true">Wow man</text:hidden-text>
>
> Now, obviously this is not possible because - hidden text actually hides the text, rather
than displaying it.

This should not be particularly difficult, using the "not-equal" logical 
operator: if editor NE "emacs" "Saint Ignatious", etc.
(Caveat: I haven't used this feature either.) IMHO, the original design 
decision was, ah, unfortunate.

HTH,
/tj/


---------------------------------------------------------------------
To unsubscribe, e-mail: ooo-users-unsubscribe@incubator.apache.org
For additional commands, e-mail: ooo-users-help@incubator.apache.org


Mime
View raw message