How to adjust style of table cell border? - styles

When I add a cell to a table, I can manipulate its thickness (borderBottomSize), its color (borderBottomColor) but not its style (dashed, dotted, longdashed, ...).
When I read the code, the PhpOffice\PhpWord\Style\Cell extends the PhpOffice\PhpWord\Style\Border.
And the border class has the attribute borderBottomStyle.
But how to configure that?
I also looked into the PhpOffice\PhpWord\Style\Line, there I can find some "dashStyles", but none of them are working...
My question: How to change style of border (from strong line to for example dotted)?

You can define the style of the border by using the cell style property borderStyle. By default, it's set to solid, but you can use other values like dashed, dotted, double, etc. Sadly, this feature is not documented so I don't know all the available styles.
Don't forget to add a border size as well, otherwise no border will be rendered.
Example for a dotted cell:
$dottedCell = $tableRow->addCell($cellWidth, ['borderStyle' => 'dotted', 'borderSize' => 6]);

Related

Is there any way to give gradient color to normal color property in flutter?

I am using Bar Chart of fl_chart plugin. I want to give gradient color to bar graph. Below is the line where I want give color.
BarChartRodData(y: 12, color: Color(0xFF639ed1),width: 12)
But it is not possible to set gradient color to the ##color## property unless it is colors.
Is there any way to set gradient color to color property?? Please help me..
If you pass just one color, the solid color will be used, or if you pass more than one color, we use gradient mode to draw. then the gradientFrom, gradientTo and gradientColorStops
For an example ,
final List<Color> color = <Color>[];
color.add(Colors.blue[50]);
color.add(Colors.blue[100]);
color.add(Colors.blue);
final List<double> stops = <double>[];
stops.add(0.0);
stops.add(0.5);
stops.add(1.0);
Please refer https://pub.dev/documentation/fl_chart/latest/fl_chart/BarChartRodData-class.html for BarChartRodData class variables

In Scala.js, modifying svg.Stylable.style

Working with Scala.js, I have created some SVG elements like Text, Line, Rect, and now I am trying to set the style attribute with code like this, where element is of type svg.Stylable:
element.style.fillOpacity = "0.0"
element.style.stroke = "yellow"
element.style.strokeWidth = "2"
I tried different variations of above code, but the desired style does not realize, and when I inspect the element in the Browser, the style attribute is an empty String (""). I am able to set other attributes with no problem (e.g. x, y, width, height).
How do I set the style? Thanks!
For SVG modications in Scala.js I normally use the d3 library (scala.js facade: https://github.com/spaced/scala-js-d3).
Then u can use:
d3.select("#mySvgElement").attr("style", "stroke:yellow; stroke-width:2") // etc.
*Edit: mySvgElement would be the ID of the element i want to change the style for. You can also other different kind of selectors.

Blue color table border using docx4j

I'm using docx4j to create a docx file. I want my table border to be blue colored but it is only showing black.how to do this?
Here is my code:
table.setTblPr(new TblPr());
CTBorder border = new CTBorder();
border.setColor("FFF");
border.setSz(new BigInteger("0"));
border.setSpace(new BigInteger("0"));
border.setVal(STBorder.SINGLE);
TblBorders borders = new TblBorders();
borders.setBottom(border);
borders.setLeft(border);
borders.setRight(border);
borders.setTop(border);
borders.setInsideH(border);
borders.setInsideV(border);
table.getTblPr().setTblBorders(borders);
You need to set the color attribute of the border in question. Your example code appears to have you setting a colour of 'FFF' which obviously won't work if it needs to be blue! I would suggest trying a straight blue in hex and going from there. For example a (very) standard blue would be:
CTBorder border = new CTBorder();
border.setColor("0000FF");

d3.js color range and lighter color range

I would like to have two color ranges, the second one must consist off the same colors, but lighter.
rangeLength=10
color = d3.scale.linear().domain([1,rangeLength]).range(['red', 'blue']);
colorLigher= d3.scale.linear().domain([1,rangeLength]).range(['red'.lighter(10), 'blue'.lighter(10)]);
Obviously doesn't work, as 'red' is a string.
Thanks in advance
You can use the brighter() function (see the documentation):
length=10
color = d3.scale.linear().domain([1,length]).range(['red', 'blue']);
colorLighter= d3.scale.linear().domain([1,length])
.range([d3.rgb('red').brighter(), d3.rgb('blue').brighter()]);

HighCharts: Color of label according to the color of pie slice

Title of this questions says everything. I only found out how to change the color of connectors. If I delete the color: option, they´re all grey. I tried to put in the field with stored colors in hex, with no result, stayed black.
In dataLabels.formatter you have access to this.point.color. So simple set useHTML: true for dataLabels, and create spans with specified colors.
the formatter function gives you a callback object, which has a color property that can be set with the color of your choice
formatter: (format) ->
format.color = #point.color

Resources