Docx4j: Bold table cells in pdf - pdf-generation

I try to make text in a table cell bold. This works great for a .docx document. When converting it to pdf the bold style is removed.
Any suggestions?
Here the code which I use to make the text bold:
P paragraph;
String openXML = "<w:p xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\">"
+ "<w:pPr>"
+ "<w:rPr>"
+ "<w:b/>"
+ "</w:rPr>"
+ "</w:pPr>"
+ "<w:r>"
+ "<w:rPr>"
+ "<w:b/>"
+ "</w:rPr>"
+ "<w:t>" + content + "</w:t>"
+ "</w:r>"
+ "</w:p>";
paragraph = (P) XmlUtils.unmarshalString(openXML);
tableCell.getContent().add(paragraph);

Related

Form location/size FMX - Win32

i'm building an FMX app for Win32 (one form only) with C++ Builder. I'd like the program to remember where it's form was located on the users screen and it's size (it is resizeable) for the next time the user runs it.
Can someone point me in the right direction?
thanks,
relayman
UPDATE: Thanks Sam. I did what you said but wrote the position info to an SQLite db instead of text file. The db has a table named "pos" with 5 integer fields. 4 are the positions and 1 is named "item" and is just to facilitate my update query (I'm not sql expert by long shot). Note, the code below needs try/catch improvements and some tests to make sure form coordinates are valid.
This code is in the form OnShow event:
TFDQuery *query2;
query2 = new TFDQuery(NULL);
query2->Connection = Form1->FDConnection1;
query2->SQL->Text = "SELECT * FROM pos";
query2->Open();
Form1->Left = query2->FieldByName("left")->AsInteger;
Form1->Top = query2->FieldByName("top")->AsInteger;
Form1->Width = query2->FieldByName("width")->AsInteger;
Form1->Height = query2->FieldByName("height")->AsInteger;
query2->Close();
query2->DisposeOf();
This code is in the form OnClose event:
TFDQuery *queryUPDATE;
queryUPDATE = new TFDQuery(NULL);
queryUPDATE->Connection = Form1->FDConnection1;
queryUPDATE->SQL->Text = "UPDATE pos set left = '" + IntToStr(Form1->Left) + "', top = '" + IntToStr(Form1->Top) + "', width = '" + IntToStr(Form1->Width) + "', heigth = '" + IntToStr(Form1->Height) + "' WHERE item = '1'";
queryUPDATE->ExecSQL();
queryUPDATE->Close();
queryUPDATE->DisposeOf();
OnClose save the position, with, height, state, ... into an INI file. OnCreate restore all that info

How to focus cursor at the end of text in ckeditor 5

This is below code:
var oldData = this.ckEditor.getData();
this.ckEditor.setData(oldData + "{" + data + "}")
after this how to focus cursor at the end of text in ckeditor 5
I am using angular 5 and ckeditor 5?

display "≤" character into a VB6 Label

I am trying to set ≤ character into a VB6 Label.
Looking at https://en.wikipedia.org/wiki/List_of_Unicode_characters
The code would be 2264 .
Label.Text = Chr(2264) generates an error
Label.Text = ChrW$(2264) sets a question mark "?"
Does anyone know how to get this ≤ character
Label.Text = ChrW(&H2264) ' <-- &H for Hexadecimal
2264 is the Hexadecimal code, you can see it here.
In Decimal, it is ChrW(8804).
The stock Symbol font contains that symbol at an ansi codepoint and so works without requiring unicode awareness, as a contrived example with 3 autosizing labels:
lbl_left.Caption = "999"
lbl_middle.Font.Name = "Symbol"
lbl_middle.Caption = ChrW$(&HA3)
lbl_middle.Left = lbl_left.Left + lbl_left.Width + Me.TextWidth(" ")
lbl_right.Caption = "1000"
lbl_right.Left = lbl_middle.Left + lbl_middle.Width + Me.TextWidth(" ")

summary in header with grouping option

does anyone have idea how can I have summary on head of my grouping column, there are pivot option but all my project are oriented with grouping option, there is a summary on bottom but this is european notation I need american notation to have summary in head, in the same row where we have expend/collapsing icon, please help me thank you
In the loadComplete use this function (changing "yourGridId to the id you used to name your grid):
$("#yourGridId tr.jqfoot").each(function () {
var summaryrow = $(this);
var level = summaryrow.attr('jqfootlevel');
var groupSelector = 'tr.jqgroup.' + "yourGridId" + 'ghead_' + level + ':first';
var grouprow = summaryrow.prevAll(groupSelector);
grouprow.children('td').attr('colSpan', 1);
var childrenSkipFirst = summaryrow.children(':nth-child(n+' + (2) + ')');
summaryrow.children().remove();
grouprow.append(childrenSkipFirst);
})
This puts the summary row's cells values in the collapsed row. Notice you could have to change the number 2 in var childrenSkipFirst = summaryrow.children(':nth-child(n+' + (2) + ')'); to another onw if you see the summary cells in collapsed row are not in line with the column header.

Reading text using selenium webdriver(xpath)

I'm using selenium to get some text on my webpage using xpath.
The page tag structure is as follows -
<span id="data" class="firefinder-match">
Seat Height, Laden
<sup>
<a class="speckeyfootnote" rel="p7" href="#">7</a>
</sup>
</span>
If I use the following code -
driver.findElement(By.xpath("//span[#id='data']")).getText();
I get the result = Seat Height, Laden 7
But I want to avoid reading the text within the <sup> tags and get the
result Seat Height, Laden
Please let me know which xpath expression I can use to get my desired result.
I don't know about any way to do this in Selenium, so there's my JS solution. The idea is to get all children of the element (including the text nodes) and then select only the text nodes. You might need to add some .trim() (or JS equivalent) calls to get rid of unneeded spaces.
The whole code:
WebElement elem = driver.findElement(By.id("data"));
String text;
if (driver instanceof JavascriptExecutor) {
text = ((JavascriptExecutor)driver).executeScript(
"var nodes = arguments[0].childNodes;" +
"var text = '';" +
"for (var i = 0; i < nodes.length; i++) {" +
" if (nodes[i].nodeType == Node.TEXT_NODE) {" +
" text += nodes[i].textContent;" +
" }" +
"}" +
"return text;"
, elem);
}
And just the JS for better readability.
var nodes = arguments[0].childNodes;
var text = '';
for (var i = 0; i < nodes.length; i++) {
if (nodes[i].nodeType == Node.TEXT_NODE) {
text += nodes[i].textContent;
}
}
return text;

Resources