Setting cell border width in Google Apps Script - google-apps-script

Although cell borders in a GoogleSpreadsheet can be set manually to 6 different styles (dotted, dashed, solid (1px width), solid (2px width), solid (3px width) and double), it seems the current version of the API is limited to the options DOTTED, DASHED and SOLID for BorderStyle. The latter has a 1px width.
Is there a way which allows me to set a border with 2px width, either by choosing one of the other 3 styles not in the BorderStyle enum, or by setting the border width by any workarounds?
Update: (revisiting this a few years later) - there are now other options for BorderStyle, including SOLID_MEDIUM which I was originally looking for.

This should work
function borders() {
SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Line 1").getRange("E21:F26").setBorder(true, true, true, true, true, true, 'black', SpreadsheetApp.BorderStyle.SOLID_MEDIUM);
}
Of course the sheet and range are just what I used for testing, should work with any range/sheet.
Here's the documentation for the border styles and here is the documentation for .setBorder

It appears that multiple border thickness options is a very new feature as of February 2017, so I don't think it has made its way into the Enum options of apps script.
Google Help Forum Post on add border style options

Related

Why is the border wider in Outlook client than in the web?

I am creating HTML template for Outlook and I want my 2 column table to have bottom borders on the columns like this, which I did by setting border-bottom property to the td element
Anyway, the picture is from the browser outlook, because when I open the client I see this .. as you can see the border of the last row is a single line, it's not split..to create a gap between the columns I use border-right: 25px solid white property.
Here is the situation with odd number of items [Img], (https://i.stack.imgur.com/231Af.png) I captured only the last 2 rows, but you can see the last item has a longer border than the upper ones. These tables are generated by code so all rows have the same properties, but still the last row makes the trouble.
The code is really long and messy, therefore I would like to ask without adding any code to the question. Do you have any ideas why this happens?
I have tried using a lot of CSS properties but none of them works.

Chome border thickness issue on zoomed resolutions: 'border-width: *px' does not fully work

This is in reference to the well-known issue in Chrome where some table border lines appear too thick on a zoomed resolution (e.g. 125%) even though they should all be the same, 1px thin. There are many threads on this: 1, 2, 3 etc. Only Chrome has this issue, other browsers are OK
The common workaround is to play with border-width: 0.5px-1.5px to find a "sweet spot" where the table borders become uniform.
But for me, I have 2 tables with 4 rows, and when I change border-width on a 125% resolution, the problem just jumps from one place to another. Below is what I'm experiencing. I just can't find any decimal value between 0 and 2 that would resolve the problem.
Windows Zoom Setting:
One other note. Changing 1px solid black to thin solid black doesn't work either, contrary to what was written here in 2018.

Zero-width borders for browser windows in XMonad

I'm new to XMonad. I'd like to have 1px borders for all windows (so I can tell which one is active), except for the browser. In a conventional window manager, I typically have one maximized web browser window in a designated workspace. I'm very used to bringing the mouse cursor all the way to the top edge of the screen to select browser tabs. But if I have 1px border around the browser window, if I slide the mouse all the way to the top it ends up over this border pixel and cannot select the tabs.
Is there a way to define different rules for specific windows regarding border width, or any other such properties?
Alternatively, is there a way to not have a border around any window, if it's the only one on the workspace?
Yes, all of it is possible.
Import xmonad-contrib's NoBorders Layout Extension using
import XMonad.Layout.NoBorders
Then, in your manageHook you can use hasBorder with conditions like checking the program's className (you may want to use XOrg's Property displayer xprop to find out your browser's actual className)
className =? "firefox" --> hasBorder False
Alternatively, you can launch your browser within a given layout and modify that layout in your layoutHook definition to not show borders at all using noBorders, or to remove them only in given one-window or fullsize-floating scenarios using smartBorders
noBorders Full ||| smartBorders Tall ||| ...

SSRS: Set layout properties group (BorderStyle, BorderWidth, Padding,...) at once

I'm starting to use SSRS and would like to start my project on a clean manner and easy to change in a future the style of the report.
So I'm declaring several parameters for each layout properties (font-family, fonz-size, color, border-style, border-width,....) and would like to know if it's possible to do "merge some" :
instead of doing this for each property :
This would be more efficient and easy to set. But Visual Studio (2015 version) doesn't allow me to do it.
In CSS we can do "padding : 10px 5px 2px 4px" or "padding-left: 10px; padding-right: 5px...." (other possiblities but wanted to show here only the corresponding).
Thanks for your help.
Yes you can - you just need to put a comma between each.
Copy and paste this into the top level padding property:
=Parameters!ReportParameter1.Value, 19pt, =Parameters!ReportParameter1.Value, =Parameters!ReportParameter1.Value
and then expand that property - you will see that padding right has been set.
Unfortunately when you select all the entities (i.e rows within a taxlib) that have different properties the Padding options for Left, Right, Top and Bottom will disappear. In order to do this, you will need to copy the formatting to a notepad. Then clear all formatting from the existing select all and then simply copy and paste. It's very daunting, but I have found that there is no other way sadly.
I found the solution !!
For example, I want to set the border color for property Left,Right,Top,Bottom at once :
Declare a parameter TableBody_BorderColor_LRTB.
In "General" check "Allow multiple values"
In "Default Values", select "Specific values
Click to "Add" 4 times for the 4 values
By our custom convention, the first value will refer to Left (L is at the first position of LRTB), the 4th value will refer to Bottom
Then select the body of the tablix, and in the BorderColor property write :
Black; =Parameters!TableBody_BorderColor_LRTB.Value(0); =Parameters!TableBody_BorderColor_LRTB.Value(1); =Parameters!TableBody_BorderColor_LRTB.Value(2); =Parameters!TableBody_BorderColor_LRTB.Value(3)
The "Black" is for the default Color.
And then we select the first value Value(0) that is assigned to Left, etc...

Chrome text shadow showing when set to 0

So, I'm in the process of building a website designer and I have come across something strange, if you set the text-shadow: 0 0 0 someColor on a element the shadow is actually applied, I have made a fiddle where this is very clear here FIDDLE.
Is this a bug?
It's not a bug in that it's not an incorrect implementation of the spec; the spec implies that a shadow is generated as long as the computed value is something other than none. The only values that can compute to none are none or initial.
Text shadows are drawn similarly to box shadows. Because of this, most of the behavior of text shadows follows the spec for box shadows. Nowhere in either spec is it stated that a value with all zeros should generate no shadow. All it says is that either property can take one of two possible values: none, or a comma-separated list of one or more <shadow> value groups, each of which corresponds to a set of values: in the case of text-shadow, it's [ <length>{2,3} && <color>? ]# as given in its own spec. As long as you have a value that isn't none, either spec assumes a shadow will be drawn and specifies all the behavior based on that assumption.
For both properties, even if you don't specify a color, both specs state that currentColor should be used (it says in prose that it's "taken from the color property" or "the resulting color of the ink that it shadows"; the result in code is currentColor).
Since the shadow is always drawn for a value other than none, and zero lengths result in a shadow that's exactly the same size as the text, what happens here then is probably the result of compositing two or more layers of semitransparent pixels due to anti-aliasing of the glyphs as well as the shadow (as stated in the comments). This applies not only to text shadows, but also box shadows, an archetypal example of which would be in a box with rounded corners, where the only hints of anti-aliasing are on the rounded corners themselves, and not the straight edges of the box. This also happens in all browsers, at least based on testing and prior experiences.
With all that said, if you absolutely cannot accept none as a value, you can always specify transparent for the color. The shadow will still be drawn, but since it's completely transparent, you won't see it.
If you want to remove a text-shadow, I suggest setting text-shadow: none;
text-shadow:none;
Optional. This is a value. If not specified, it defaults to 0. The higher this value, the bigger the blur; the shadow becomes
wider and lighter.
The blur property does not indicate no blur when set to zero.
https://developer.mozilla.org/en-US/docs/Web/CSS/text-shadow
text-shadow: 0px 0px 0px #FFFFFF; these properties not for hide or show. move shadow up down, move shadow right left and blur level 0 is clear.
if you want hide Shadow Then : Write "text-shadow:;" but dont set any value it should be empty.
sorry for bad english :)
If you're building a page builder and want initial "empty" values (which they're not empty, the first two zeroes indicate positioning and the last how much blur) you may just want to set the color as a default to the element background color. Or you can change your blur value to -1.
text-shadow: 0 0 -1px red;
The other option I can think is to have them enable text-shadow and then put in your 0 0 0 red using an if else statement. Pseudocode:
if text-shadow option is checked
use text-shadow:0 0 0 red;
else
use text-shadow:none;
Good luck.