Conditional formatting?

Getting your data onto paper - or the web - Discussing the reports features of Base
Post Reply
User avatar
MSPhobe
Posts: 93
Joined: Tue Jan 15, 2013 6:05 pm
Location: Usually UK, sometimes USA(CT)

Conditional formatting?

Post by MSPhobe »

Suppose I have a query producing...
Goblet of Fire
Moby Dick
-- Rockwell illustrations
Seven Pillars of Wisdom
The Hobbitt
-- Second edition
The Spire
Winnie-The-Pooh
Yearling
-- Pristine dust jacket
(Which I do!)... (See http://forum.openoffice.org/en/forum/vi ... 42&t=91167% for how that was done.)

The query scans a table with a book inventory. The table has "Title" and "Comment" fields. The query always produces a line in it's output table for every title. It also, but only when there is something in the Comment field, it produces a line with the comment, pre-fixed with '--' (Which is not anything to do with using "--" to put a comment in some SQL... it just seemed a good idea at the time as a way to distinguish a comment line.

So... according to the sample above, there is nothing in the Comment field for the Goblet of Fire record, but ther IS ("Rocwell Rockwell illustrations") for the Moby Dick record.

Whew! That's the context.

I'm hoping someone can help me do...

I want a report with the title names in one style (font-name/ size/ color, etc), and the comment lines (if any) in a different style.

Maybe the "--" at the start of each line helps... of maybe not, maybe a completely different approach is needed?

I'm hoping all this can be done under OO 4.1.1, using the embedded HSQL engine. (Apologies.. earlier that said "4.4.1"... checked it TWICE, still got it wrong!)
Last edited by MSPhobe on Sun Nov 12, 2017 11:55 pm, edited 1 time in total.
OpenOffice 4.1.1 on Windows 7, plus others on XP. "Native", and as FE to MySQL
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Conditional formatting?

Post by Villeroy »

1. A Writer document (a serial letter) with database fields combined with conditional fields can do the trick without the nasty UNION query.
2. A Calc spreadsheet can do conditional formatting. All my reports are Calc sheets.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
MSPhobe
Posts: 93
Joined: Tue Jan 15, 2013 6:05 pm
Location: Usually UK, sometimes USA(CT)

Re: Conditional formatting?

Post by MSPhobe »

Can either (both?!) meet my want of not having blank lines where there is no comment, please?
OpenOffice 4.1.1 on Windows 7, plus others on XP. "Native", and as FE to MySQL
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Conditional formatting?

Post by Villeroy »

1. Yes. http://freesoftwaremagazine.com/article ... ffice_org/ (figure 3: hiding blank lines)
2. Define the query so it does not include any blank values nor empty strings. Calc can do that too.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
chrisb
Posts: 298
Joined: Mon Jun 07, 2010 4:16 pm

Re: Conditional formatting?

Post by chrisb »

MSPhobe,
the Report Builder extension supports conditional formatting.
i do not know whether you are familiar with Report Builder so i have uploaded an attachment in order to avoid any issues.

when the report is opened in edit mode then the necessary formatting is easily achieved by:-
1. select the text box to be formatted (TitlePlusComment).
2. menu:Format>Conditional Formatting.
3. as each of our 'Comments' is preceded by '--' i have used the expression 'LEFT([TitlePlusComment];2)="--"'.
when the expression is true then the field will be formatted in accordance with the selected options (six icons 'B', 'I', 'U' etc.).

other forum users have suggested alternative solutions. i am simply responding to the issue as stated which may/may not be the best option. you must decide.
Books.odb
(23.84 KiB) Downloaded 322 times
open office 4.1.14 & LibreOffice 6.4.4.2 x64 using HSQL 1.8.0.10 (Embedded) and HSQL 2.6.0 (Split) on Windows 10
longi
Posts: 110
Joined: Mon Jul 15, 2013 5:04 pm

Re: Conditional formatting?

Post by longi »

Hi!

If you are not using ORB you can get similar results, but using code (which could bother you )
Here you have several examples:

https://forum.openoffice.org/es/forum/v ... 70&t=11605

If only you want the conditional formatting, it's better you use the ORB extension.

Bye!
OpenOffice 4.1.5 on Windows 10
LibreOffice 5.1 on Windows 7
LibreOffice 6.0.1 on Windows10
Post Reply