Tip: how to remove node annotation font formatting

Dear Knimers,

I noticed that when you change the format of a node annotation/label (font size, etc) inconsistencies can arise when the workflow is copied between different platforms. This is because nodes for which this was performed no longer automatically follow the global font settings. This can result in a very ugly looking workflow. There does not seem to be a way to remove these font settings through the normal knime UI.

Solution: in Linux, after installing “xmlstarlet” with your system’s package installer (for example sudo apt-get install xmlstarlet), execute the following command in bash in the workflow’s directory:

find . -name 'settings.xml' -exec xmlstarlet ed --inplace -P -N x='http://www.knime.org/2008/09/XMLConfig' -d "x:config/x:config/x:config/x:config[@key='style_0']" {} \;

This will remove the font settings from all the node annotations so they look the same.

I hope this is useful for someone. Use at you own risk; you might want to backup your workflow before trying this…

Cheers
Aswin

8 Likes

I have noticed this problem when transferring between Windows and MacOS

I haven’t tried it, but the same command would probably work under Windows by using WSL or under MacOS by installing xmlstarlet via homebrew (https://formulae.brew.sh/formula/xmlstarlet#default)

This problem may also happen with metanode annotations, but the font settings for metanodes are stored in “workflow.knime” files, not “settings.xml”. Therefore it may sometimes be necessary to repeat the command for all “workflow.knime” files:

find . -name 'workflow.knime' -exec xmlstarlet ed --inplace -P -N x='http://www.knime.org/2008/09/XMLConfig' -d "x:config/x:config/x:config/x:config[@key='style_0']" {} \;
2 Likes

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