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

@conniem,

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;
    AsposeDocument.MailMerge.ExecuteWithRegions(dt);
}

Hope, this helps.