Google sheet borders based on backgroundcolor - google-apps-script

Since conditional format does not allow setting borders, is it possible to create a script and border a row based on the color of a cell / row?
If so how?
I found similar scripts, but no scripts based on background color.
I need something to get started / push in the right direction....

You can use Range.getBackground() to get the background color from one cell, or Range.getBackgrounds() to get the background colors from multiple cells.
You can then use that information to set your desired borders, using Range.setBorder.

Related

Stripes in background in RDL

Is it possible to add stripes in the textbox in report?
So the result looks like in the picture?
User chooses color for the column in the application
color
This is no built in way of doing this (no fill style) but you could use an image of the stripes as a background image. You would need to create and save images for each colour and style and add them as embedded images in the report.
You can then set the background image of a textbox to the required image.
... or better still use an expression to select the image based on conditions.
=SWITCH(
Fields!ItemCode.Value >10 , "RedStripe",
Fields!ItemCode.Value >50 , "GreenStripe",
True, Nothing
)
Where Redstripe and GreenStripe are the image names you embedded.
You can set the image to repeat etc from the properties panel
Update after OP stated that colour is parameterised.
If the colour is a parameter then we need a slightly different approach.
First you need to create an image with stripes (any colour will do ), and then remove the stripe pixels so that the stipes are now transparent. Save this as a PNG.
I created one quickly whist testing which you can save from here hopefully. You'll just have to move the mouse around in the area below as it's a white on white image! Or switch StackOverflow to the dark theme, then you can right-click and save the image. If not you'll just have to create one yourself.
Image below here.. switch StackOverflow to Dark theme to see it
Image above here..
Now you will need to set the background image to this image but also set the backgroundcolor property to an expression. In this exmaple, I set the background to the value of my parameter.
My parameter is just text and I typed in some hex values in the form #FFFFFF. You will have to work out how to get the value from your color pickers to the report yourself, ask a new question if required.
Here's the report design
and here is the report running using a few sample hex values.

How to add a border to SparkLine data?

How does one go about indicating a colored border in an Area Chart Sparkline, as seen in this example:
https://learn.microsoft.com/en-us/sql/reporting-services/report-design/sparklines-and-data-bars-report-builder-and-ssrs?view=sql-server-2017
I've been able to configure the light blue foreground, by setting the Palette property to Custom and adding the color RGB(204,220,235) to the CustomPaletteColors collection, but there doesn't seem to be a border-related property for the data series. I also tried adding several other colors to the collection, but that had no effect.
The border properties—BorderColor, BorderStyle and BorderWidth—operate on the cell, not the series.
OK, I found it.
It's on the Series Properties dialog, here:

SSRS - Indicator and value in same cell?

I have created a Directional indicator (Green up arrow and Red down arrow) in my SSRS report, referring to the value of the column next to it. This all works ok:
However, I really want the indicator and the value to be in the same cell, like Excel can:
A Google found the following article , where the last post suggest it is possible using the following syntax:
=Format(Fields!Column1.Value, "Format") + " " + "Indicator"
I assume "Indicator" refers to the name I gave to my Direction indicator, but I can't get it to work..
I have read that by using border formatting I can get my two cells to look like one, but I would ideally like it all to be in one.
Any thoughts appreciated!
Mark
I would do this by placing a Rectangle inside of the cell and place your indicator along with another text box inside the rectangle. The downside to this is (depending on how you align the items in the rectangle) the formatting may cause split cells in excel exports.
Ross's method will work and there are alternatives..
The article you referenced was a text indicator not an image (from what I could tell).
You could do something similar by simply adding a a placeholder in the cell (right-click inside the cell and click "create placeholder"). You can then set the font and colour independently from the rest of the cell.
You could use a common font such as wingdings to get arrows and then the value and color properties would be expressions to show the correct 'character' (arrow) and the correct colour.

Colored cells in Squirrel SQL client

I use Squirrel SQL client to query my DB2 database. When I query one of the tables, I see some of the cells background are shown colored (teal). I am not sure why those cells can be shown in a teal color while other cells’ background are still in white. I did some research online and found multiple scenarios where the cells could be colored.
If the cells have multi-line texts.
If the cells have reached the maximum number of allowed characters.
If the cells are set as read-only.
Based on the above, I checked my table structure. All the colored cells have multi-line texts. None of them have reached the maximum allowed limit in number of characters. I right clicked in a colored cell and I am able to make it editable. Only match I could find is, all the colored cells have multi-line texts. Is there any other reasons that could cause the cells to be shown in a different color?
I did some more research in my table structure and got answer.
Squirrel shows colored cells only when they have multi-line texts in them.

changing indicator background

I have a table with alternating row colors (I used the following expression =iif(RowNumber(Nothing) Mod 2, "Gainsboro", "White")). Now in one of the table's cell I putted an indicator.
When I run my report, the indicator's background color stay fixed as white:
I tried to set the indicator background color to no color.
I also did some workarounds (created image files with the indicator icons - 2 images per icon (each one with different background color), and used an expression to switch between the images. but this workaround is restrictive (because i have to keep the cell proportions right as the image proportion - otherwise the images presented badly)
Do you know any option/better workaround to solve this issue ? thank you.
Ok,
The way to fix it is as follow
Solution for problem 1:
Click on the "Row" itself not on one of the columns (See screenshot)
Then add your expression to the "Background Color" Property
=iif(RowNumber(Nothing) Mod 2, "Gainsboro", "White")
Solution for problem 2
The way to force the image not to increase is to set the column property "Can Grow" to False
Please do so to every column (See screenshot)
I hope it helped you :)
This thread may help: it suggests you wrap the img inside a rectangle, apparently transparency in images is then forced to be rendered correctly.