Change the default font of the tables

Hi @CarolinaPR ,

Unfortunately I could not see any mechanisms within the existing XLS nodes for specifying the default font either. The XLS Font Formatter node appears to format everything except for the actual chosen font. I could not find any other nodes that would assist directly either.

So I came up with only one solution, unless somebody else has another suggestion. But it does require Python 3 to be available. Do you have Python 3 and the openpyxl package installed for use with your KNIME environment? If you do, you can try out an “Excel Font Changer” component I have put together using a Python Script node.

It doesn’t change the “default” font, but what it will do is set the font for the existing cells on a specified sheet within an XLSX that has already been written.

The intention (and it seems to work) is that it leaves all other attribute of each cell (size, colour, italic, bold) untouched, and just modifies the font name.

e.g. font set to “Algerian”:

font set to “Arial”
image

and just for giggles… font set to “Wingdings” :wink:
image

A demo workflow can be found here:


and the component is here:

It’s very much a proof of concept, but it does the job. It might be a little slow if you have very large spreadsheets as it has to set every cell individually. There doesn’t appear to be a way of setting it across an entire sheet in Openpyxl.

If you are able to use it, and you find it could do with some refinements, let me know and I’ll do what I can to assist.

3 Likes