MailMergeTrimWhitespaces Property

Gets or sets a value indicating whether trailing and leading whitespaces are trimmed from mail merge values.

Namespace:  Aspose.Words.MailMerging
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.9.0

Syntax

public bool TrimWhitespaces { get; set; }

Property Value

Type: Boolean

Remarks

The default value is true.

Examples

Shows how to trimmed whitespaces from mail merge values.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

builder.InsertField("MERGEFIELD myMergeField", null);

doc.MailMerge.TrimWhitespaces = doTrimWhitespaces;
doc.MailMerge.Execute(new[] { "myMergeField" }, new object[] { "\t hello world! " });

if (doTrimWhitespaces)
    Assert.AreEqual("hello world!\f", doc.GetText());
else
    Assert.AreEqual("\t hello world! \f", doc.GetText());

See Also