wxpython, richtextctrl: How to remove borders in a table? - attributes

I want to display a richtextctrl table without borders. I can change some attributes of the table (e.g. font), but I haven't figured out how to change the attributes of the margins. I tried to color the frames with the background color. The font changes but the frame color does not:
...
font = self.GetFont()
attr = rt.RichTextAttr()
attr.SetFlags(wx.TEXT_ATTR_FONT)
attr.SetFont(font)
attr.GetTextBoxAttr().GetBorder().GetLeft().SetColour(wx.Colour(255, 255, 255)) #the program passes but nothing changes.
table = self.WriteTable(5, 2, cellAttr=attr)
...
The full code can be found here: Setting properties for table and cell in RichTextctrl
I'm attaching a picture of what it looks like:
At the top is the current output, below is the table as I would like to display it.
How to do it, please?

Related

How to set UIDatePicker background color to white in xamarin.ios for ios 14?

I am hiding a label by a UIDatePicker in a xamarin.ios app. I changed the style of the datepicker label but can't change the background to white. Here is my code:
datePickerDateFrom.Frame = lblFromDate.Frame;
datePickerDateFrom.Subviews[0].Subviews[0].SetValueForKey(UIColor.White, new NSString("backgroundColor"));
datePickerDateFrom.Subviews[0].Subviews[0].TintColor = UIColor.Black;
datePickerDateFrom.Subviews[0].Subviews[0].Layer.BorderWidth = 1;
datePickerDateFrom.Subviews[0].Subviews[0].Layer.CornerRadius = 6;
datePickerDateFrom.Subviews[0].Subviews[0].Layer.BorderColor = UIColor.FromRGB(0, 184, 212).CGColor;
datePickerDateFrom.SizeToFit();
Add(datePickerDateFrom);
And the result is:
Any other color works but if I set the color to white it remains this ash color that's why sometimes there is a color difference inside the blue border when the short date format is selected. I don't know is it possible to align the value inside the frame and specify any fixed date format(as sometimes it displays 3 letter of month name when gets larger space). For now changing the background color to white would be a great help. Thanks in advance.

Highlight the word in ppt using python-pptx

I want to read ppt and highlight certain word(background color added if background color is not possible then change the font color) in the slide. I am able to do it at sentence level i.e. if that word is contain in paragraph then it will change the font color of whole text but i want to change the color of that word only.
How about the following for highlighting?
def set_highlight(run, color):
# get run properties
rPr = run._r.get_or_add_rPr()
# Create highlight element
hl = OxmlElement("a:highlight")
# Create specify RGB Colour element with color specified
srgbClr = OxmlElement("a:srgbClr")
setattr(srgbClr, "val", color)
# Add colour specification to highlight element
hl.append(srgbClr)
# Add highlight element to run properties
rPr.append(hl)
return run
It's hacking the XML but for highlighting (text background) that's what you have to do.

Is there a way to change height of tkinter Treeview heading?

I got a problem with changing the height of the Treeview.heading. I have found some answers about the dimensions of Treeview.column, but when I access Treeview.heading in the documentation, there is not a single word about changing the height of the heading dynamically when the text doesn't fit (and wrapping it) or even just hard-coding height of the heading in pixels.
I don't have to split the text to two rows, but when I just keep it that long the whole table (as it has many entries) takes up the whole screen. I want to keep it smaller, therefore I need to split longer entries.
Here is how it looks like:
I can't find any documentation to verify this but it looks like the height of the heading is determined by the heading in the first column.
Reproducing the problem
col_list = ('Name', 'Three\nLine\nHeader', 'Two\nline')
tree = Treeview(parent, columns=col_list[1:])
ix = -1
for col in col_list:
ix += 1
tree.heading(f'#{ix}', text=col)
The fix
col_list = ('Name\n\n', 'Three\nLine\nHeader', 'Two\nline')
or, if you want to make it look prettier
col_list = ('\nName\n', 'Three\nLine\nHeader', 'Two\nline')
The only problem is I haven't figured out how to centre the heading on a two line header
Edit
The newlines work if it is the top level window but not if it is a dialog. Another way of doing this is to set the style. I've got no idea why this works.
style = ttk.Style()
style.configure('Treeview.Heading', foreground='black')
you can use font size to increase the header height for sometimes;
style = ttk.Style()
style.configure('Treeview.Heading', foreground='black', background='white', font=('Arial',25),)

How to adjust style of table cell border?

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]);

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");

Resources