EDI template - retaining leading spaces

Hi,
We are using EDI template to convert the record list to a flat file. One of the fields in record should have leading spaces. When I use getTemplate service and conertToString, leading spaces disappear and variable is left justified.

This variable is defined in template as:

Is there a way to retain the leading spaces while converting record list to flat file using getTemplate.

Any help is much appreciated.

Thanks,
Sridhar

I see a solution in this forum to change position and length if leading spaces are always of same length. It wouldnt work for me as the length varies every time.

Thanks,
Sridhar

I had once a similar problem. My solution (simple but it worked) was to use another symbol instead of spaces and after ConvertToString I then used Replace to get the symbol replaced by blank spaces.
Maybe others have a nicer solution, but I know at least this one works.

Thanks much. This works great. Simple solution too!!!
Sridhar