We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Trim Trailing & Leading White Spaces from Merge Field Values during Mail Merge using C# .NET

fields.zip (29.5 KB)
attached is source code and input.
Issue is the input has a text value with 10 spaces at the beginning of the line.
but the output does not have the leading spaces.
Tested with Aspose 19.12 and 20.5


Please set MailMerge.TrimWhitespaces property’s value to false to indicate that trailing and leading white-spaces from mail merge values should be trimmed during mail merge.

static void doMerge(Document AsposeDocument, string tName)
    AsposeDocument.MailMerge.TrimWhitespaces = false;

Hope, this helps.