Edit HTML content after Table to HTML node

Continuing the discussion from How to design or manipulate HTML for send email:

Curious if anyone has tried editing the HTML after the Table to HTML node. I’d like to do things like “right align”, “change font color”, etc.

1 Like

Hello @elohbeck,

if you are talking about Table to HTML node then don’t think there’s a way to do such editing. However you can use BIRT to produce desired report format. Here is Getting Started with BIRT in KNIME blog post:

And here is link to user guide:

https://docs.knime.com/latest/report_designer_user_guide/index.html

Br,
Ivan

Are you using the Table to HTML or the Table to HTML String node?

In the Table to HTML String node I think you may be able to achieve what you want by editing the CSS on the Styles tab?

It doesn’t look like there’s an XML equivalent to the JSON Transformer which would be ideal for this scenario. You could go string → XML → JSON transform and back but that’s going to be a bit too complex to be worth it.

Cheers

Sam

1 Like

@swebb , do you know if the CSS Editor node could edit the styling after the Table to HTML String node? I tried it with no success and could not find any examples of that working.

I wouldn’t have thought so. The CSS Editor node expects to be editing a stylesheet whereas the Table to HTML String node uses inline styles. Though it looks like it adds additional styles rather than edits the input.

I’ve just done some investigation and it looks like the following is possible:

<html>
	<head>
		<style>
                <!-- Your styles here -->
			.table {
				background-color: red
			}
		</style>
	</head>
	<body>
        <!-- Table content here -->
    </body>
</html>

You could in theory then be using the CSS editor to provide a custom stylesheet to apply to the table.

This will require some manipulation of the output of the node though as I don’t provide just the table section I also include the html and body tags.

Support if this seems to be email client dependent.

I’ll see if I can knock up a simple example.

Cheers

Sam

Here’s an example:

CSS:

Table HTML string:

You can basically write your own CSS there. Though ass I haven’t added any ids or classes to the table HTML if you need to refer to things like a missing cell you’ll have trouble.

There may be a benefit to having a second node where it creates just the table element with some classes added so you can make your own custom CSS.

Cheers

Sam

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.