Today I wanted to format a boolean value in a spreadsheet so that true values are shown as “Sì” and false as “No” (italian words for “yes” and “no”). I was easy as librelive describe in Change Boolean to Yes/No instead of True/False – Ask LibreOffice
i suggest basically the same as
m.a.riosvwrote, but a little better:in
format cellsdialogue fillformat codeinput with the following:
[=1]"Yes";[=0]"No";General– this means it will beyesontrue/1values,noonfalse/0values and will usegeneralformat otherwise.one may even use the following string to format it as
✓/✗instead ofyes/noand color differentiation:[GREEN][=1]"✓";[RED][=0]"✗";[BLUE]General;[BLUE]@this works on libreoffice calc v6.1.5.2 for ubuntu – i’ve tested
i call it “a little bit better” solution because it implements
design by contractpattern, i.e. if for some unexpected reason the value will be something else than a boolean, then it will be displayed as usual, and not hidden, thus hiding a possible error in design!
But the real gem is finding a reference to design by contract!
