[Dropped] Conditional formatting which preserves borders

Discuss the spreadsheet application
Post Reply
gmccollam
Posts: 14
Joined: Thu Aug 27, 2015 5:45 pm

[Dropped] Conditional formatting which preserves borders

Post by gmccollam »

Is there a way to not have conditional formatting not overwrite a cells borders? I have set styles without setting borders, but when I apply to a cell that has borders, it overwrites and removes the borders. Is there a way to leave the borders intact if you don't want them overwritten. I would like to use the same style in a conditional format on cells that have borders and cell that do not have borders without setting different style for each possible border setup.
OpenOffice 4.1.1 on Windows 10
User avatar
Villeroy
Volunteer
Posts: 31348
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: conditional formatting

Post by Villeroy »

This is impractical. You can't have borders with conditional formatting unless all cells have the same borders. A conditionally formatted range with one set of outside borders needs 4 stlyes for the corner cells and 4 styles for each side plus one for the center cells. That is 9 styles for each condition and 9 ranges with different conditional formats.

P.S. Perhaps you can set the outer borders of the adjacent cells instead of the conditionally formatted range.
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
Villeroy
Volunteer
Posts: 31348
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: conditional formatting

Post by Villeroy »

Villeroy wrote:P.S. Perhaps you can set the outer borders of the adjacent cells instead of the conditionally formatted range.
Like this
Attachments
CF_Borders.ods
(18.94 KiB) Downloaded 168 times
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
gmccollam
Posts: 14
Joined: Thu Aug 27, 2015 5:45 pm

Re: conditional formatting

Post by gmccollam »

Your point is exactly what I was saying, I don't want borders in the "condition" because you would have too many, but I can't use borders on the adjacent cells because I want borders between conditional cells that are next to each other. However, not having borders in the conditions overwrites the existing cell border with no border thereby erasing the existing border. Can you have conditional formatting that doesn't erase existing borders?
OpenOffice 4.1.1 on Windows 10
User avatar
Villeroy
Volunteer
Posts: 31348
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: conditional formatting

Post by Villeroy »

No, I don't think so.
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
Zizi64
Volunteer
Posts: 11495
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Conditional formatting which leaves borders unchanged

Post by Zizi64 »

You can not apply the properties of a Style partially. All of the properties will be applied. If you want no border in one case, and you want borders in an another case, then you must create and apply - at least - two different Cell Styles.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
User avatar
Villeroy
Volunteer
Posts: 31348
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Conditional formatting which leaves borders unchanged

Post by Villeroy »

OK, I can offer a macro solution. It is not trivial, but once you have applied this solution sucessfully, the spreadsheet does no longer depend on these macros.
One macro generates 15 bordered substyles to a given borderless style.
The other macro applies the appropriate bordered styles to selected cell ranges that have been conditionally formatted with those borderless styles.
The attached document has unformatted random numbers in a rectangle, a row, a column of cells and a single cell and instructions how to make the example work. The final conditional formatting keeps on working even if you strip all macro code from that document. The code just performs the tedious work you don't want to do manually.
Attachments
CF_Borders.ods
(26.7 KiB) Downloaded 168 times
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
Post Reply