HTML: aligning the text in all the cells of a table? - html

While making a table in html, I can format the text of the whole table by putting some style values inside the "table" tag, and I can format a row by putting style values in the "tr" tag. Some values that work this way are "font-family," "font-size," and "color." However, other values do not work this way, e.g. "text-align." If I want to align the text inside the cells, I have to put the "text-align" value in each "td" tag.
Is there a way to format the text inside all the cells by entering the "text-align" value just one time?
I cannot use CSS, because the hosting website does not allow it (it is a wordpress.com blog).

Related

How do I add custom styling to a small part of Angular Material Table cell?

I want to change the color of the text displayed in a cell of a Material Table.
I have an array as my datasource where type is MatTableDataSource.
Some cells have regular text in them, like
rubber ducky.
I want to be able to change the color of part of that string, lets say duck.
My first idea was to add a span with some class that would do that, but the table won't let me add HTML tags, so when i do, I get the whole tag showing up as a text.
Is there a solution to this issue?
To summarize:
Problem - change color of part of text in Angular Material table (MatTableDataSource)
Failed attempt - insert span tag around text that needed styling. didn't work because table will display tags as regular text.
Looking for other suggestions.
Thanks!
Using <span [innerHtml]='myvar'> instead of {{myvar}} solved it. I am not sure if there is a better solution

How to convert HTML into formatted Text so that the layout such as spacing, table borders, element positioning remains intact?

How to convert HTML into formatted Text, so that the layout such as spacing, table borders, element positioning remains intact? Is there any tool for the same?
Tried a few options already as follows but output formatting is not as desired:
TxtControl conversion
PythonCom conversion
Issue: Converting HTML table with spacing between cells resulting in cell content getting moved to next line hence disturbing the formatting.
Expected output is: Table row cell content shall be in the same line and border shall be intact in the text file.
Also, PDF/RTF to TEXT conversion will also work just formatting should be intact.
Attaching screenshots for more clarity on the requirement.
INPUT HTML SCREENSHOT
OUTPUT TEXT SCREENSHOT
Alternatively, is there any way to read HTML character by character and write into text file so that the layout does not change in text output.
Does this work?
You can convert HTML into BBCode and you have a RTF editor.
http://www.ecardmax.com/hoteditor/
Just make sure to check the HTML Checkbox so that you can insert HTML into that. So when you paste your text, you choose the HTML part, you should try both.
Here are the results of the post from yours in BBCode
Note that that is my edited version:
How to [B]convert[/B] HTML into formatted Text, so that the layout such as spacing, table borders, element positioning remains intact? Is there any tool for the same?
Tried a few options already as follows but output formatting is not as desired:
[LIST=1]
[*]TxtControl conversion
[*]PythonCom conversion[/LIST]
[B]Issue:[/B] Converting HTML table with spacing between cells resulting in cell content getting moved to next line hence disturbing the formatting.Expected output is : Table row cell content shall be in same line and border shall be intact in text file.
Also, PDF/RTF to TEXT conversion will also work just formatting should be intact.
It could be that you manually need to remove something from it, as example I had to remove the text called "Thanks for your edit!" that appears when you edit something and it's still in pending.
This is useful if you want to convert old posts you can't access anymore on XenForo.
You then could put it into a text replacer, where it could replace [B] into **

XPath - get text from whole document except text from specified elements

I'm trying to figure out how to get text using XPath and exclude some tags.
Let's say (for illustration) I want to get all text from this page's body tag (so all visible text), but I don't want my text to contain text from tags with class="comment-copy" i.e. I don't want text to include comments.
I tried this but it doesn't work. It returns text including comments.
//body//text()[not(*[contains(#class,"comment-copy")])]
Do you have any idea?
EDIT:
Probably figured it out but maybe there are better or faster approaches so I won't delete the question.
//body//text()[not(ancestor-or-self::*[contains(#class,"comment-copy")])]
You were very close.
Just change
//body//text()[not(*[contains(#class,"comment-copy")])]
to
//body//text()[not(contains(../#class,"comment-copy"))]
Note that this will only exclude immediate children text() nodes of comment-copy marked elements. Your follow-up XPath will exclude all descendant text() nodes beneath comment-copy marked elements.
Note: You might want to beef up the robustness of the #class test; see Xpath: Find element with class that contains spaces.

How to deal with CMS style HTML fields and malformed HTML

I have a text field on my Django site that allows certain users to insert HTML and text, and I want to make sure that the inserted text does not mess with the code outside of the <div> that contains the text.
For instance, if I accidentally specify "</div>" without an opening tag, I wouldn't want the textfield to malform/escape out of the parent <div>.
What is the best way to deal with this? I want to continue to allow full HTML on this field at the moment as I only use it personally to create posts.

VBA - strip hidden HTML from cells in Excel

I have an order form on an Excel worksheet. The values in some of the cells must be very specific values in order for other functions to work right.
I'm not sure how it happened, but at least two of the cells had what looked to be simply a trailing space after the value. It turns out that the problem was that the text had hidden <p> tags wrapped around them.
The Trim function doesn't fix it. What would get rid of the <p> tags and presumably any other hidden HTML in an Excel cell?