convertToString w leading spaces

I use convertToString with my own template to create a positional flat file for an interface.
I have some fields in which I have added leading spaces. However after running convertToString these fields will now have trailing spaces.
I have no idea of how to get around this problem and the interface will only accept these fields with leading spaces.

I ran into the same issue once. This is how I solved it:
In the process before the convertToString step, I defined the actual length of the variable (trim and length transformers), than dynamically in the template changed the offset and length for the field to the values I needed.
E.g. if normally the field would start at offset 20 with length 10, if the actual length was 6, I changed in the template the offset to 20 + 10 - 6 and the length to 6
I hope this works for you too.