Apache OpenOffice (AOO) Bugzilla – Issue 105612
Provide a RICHTEXT() function for dynamic text formatting of formula output in cells
Last modified: 2017-05-20 09:56:12 UTC
Provide a function called 'RICHTEXT()' for use in cell formulas in OOo Calc , that will take one string argument possibly containing html-like tags, and return the plain text stripped of all the tags -- and, when used as a top-level function in a cell formula, will cause the returned text to be formatted inside the cell according to those HTML-like tags. For example, a cell with the following cell formula would then show the text "Title (subtitle)" with nice bold/italic formatting: =RICHTEXT("<b>Title</b> (<i>subtitle</i>)") The internal value of the cell, for example when referenced by another formula, would however just be the plain string "Title (subtitle)". At a minimum, the tags <b>, <i>, <u>, <color> and <size> (or however you wish to name them) should be supported. This would allow for much much greater flexibility and convenience for designing visually pleasing dynamic spreadsheets, compared to the rather limited and really cumbersome to use 'STYLE()' function and 'conditional formatting' feature. (Note: Maybe it would then make sense to also introduce a 'MASK()' function, that will augment a given string in such a way that 'RICHTEXT()' won't interpret any part of it as formatting tags -- for example, by making the replacements "&" --> "&" "<" --> "<" ">" --> ">" which 'RICHTEXT()' would then convert back to the original characters in it's plain text output. This would then allow to safely write, for example: =RICHTEXT("<b>For bold text use the tag:</b> " & MASK("<b>") which would display the string "For bold text use the tag: <b>" inside the cell, with partially bold formatting of course.)
I would probably suggest something like: 1.) HTMLSTYLE(string) Format using html-tags 2.) HTMLENCODE(string) eencode the string as valid html text 3.) HTMLDECODE(string) decode html-encoded string to plain text 4.) ODFSTYLE(string) Format string, interpreting it as an ODF-stream
Moved to page: https://wiki.openoffice.org/wiki/Extensions/Ideas/Calc