Created attachment 181815 [details] Screenshots showing the problem I have a sheet with a column (see Column D in the screenshot) where values are either "F" or "P" and I would like to format cells based on their values so that cells with "P" are formatted with the "Good" style. So I select the cells and go to "Format - Conditional - Condition" and apply a conditional formatting so that cells "equal to" "P" receive the "Good" style. The formatting itself works as expected, but the preview box shows weird content (again, see attached image). Notice that the preview has the values "P P P P F P P P F P ..." as though a single string was being formatted. What's more, "P"s and "F"s are marked as green in the preview, which is weird because I'm only formatting cells with "P". Cells with "F" should remain white. In summary, we could improve this preview. I'm still unsure what strategy we should take, but here are some options: 1) We could have a default preview value, with generic text or number (or a default value depending on the "Number Format" chosen for the style) to which the style can be applied in the preview 2) We could use the contents of the first matching cell to serve as sample in the preview. The only problem is if there's no matching cell to use as sample. 3) We could use strategy (2) above and if no matching value is found, then we use (1) System info Version: 7.3.5.2 / LibreOffice Community Build ID: 30(Build:2) CPU threads: 12; OS: Linux 5.15; UI render: default; VCL: kf5 (cairo+xcb) Locale: pt-BR (pt_BR.UTF-8); UI: en-US Ubuntu package version: 1:7.3.5-0ubuntu0.22.04.1 Calc: threaded
Apparently, the preview picks up the content from all selection. If you define the CF for a single cell, which is rarely useful, only this value is shown. If the CF applies to the whole column it centers the data. Showing the single "F" and "P" make sense in this example but has limits. For example Cell value > 10 could be any large number. We are probably better off with a static text like "42", "Sample", or "Preview" (the strings could be localized).
We discussed the topic at the design meeting and recommend to use the static text "This is a preview". Code pointer might be sc/source/ui/condformat/condformatdlg.cxx => ScCondFormatList and ScCondFrmtEntry