We are using Aspose.Words in our application as a third party library. Our application is written in OpenEdge and is able to do the mailmerge. However, we have an issue if our word template contains a conditional statement.
For example, we have this conditional statement (see below). In the statement, there’s tab and carriage return. If one of the field in the condition is blank, we want
to remove the whitespaces (tabs, carriage return) so that there’s no blank lines being generated.
{ IF {MERGEFIELD LineType } = “Header” “{ IF { MERGEFIELD ManagerCode } <> “” “Manager:” “”
} <Tab> { MERGEFIELD ManagerCode } <Tab> {MERGEFIELD ManagerName } <CR>
{ IF { MERGEFIELD AgentCode } <> “” “Agent:” “” } <Tab> { MERGEFIELD AgentCode } <Tab>
{MERGEFIELD AgentName } <CR>
{ IF { MERGEFIELD ClientCode } <> “” “Client:” “” } <Tab> { MERGEFIELD ClientCode } <Tab>
{MERGEFIELD ClientName } <CR>
{ IF { MERGEFIELD EstateCode } <> “” “Estate:” “” } <Tab> { MERGEFIELD EstateCode } <Tab>
{MERGEFIELD EstateAddress } <CR>
{ IF { MERGEFIELD PropertyCode } <> “” “Property:” “” } <Tab> { MERGEFIELD PropertyCode }
<Tab> {MERGEFIELD PropertyAddress } <CR>
{ IF { MERGEFIELD TenantCode } <> “” “Tenant:” “” } <Tab> { MERGEFIELD TenantCode } <Tab>
{MERGEFIELD TenantName } <Tab> {MERGEFIELD TenantContact} <CR>
{ IF { MERGEFIELD LeaseCode } <> “” “Tenancy:” “” } <Tab> { MERGEFIELD LeaseCode } <Tab>
{MERGEFIELD LeaseAddress } <CR>
{ IF { MERGEFIELD InvStatusCode } <> “” “Inv Status:” “” } <Tab> { MERGEFIELD InvStatusCode }
<Tab> {MERGEFIELD InvStatusDescription } <CR>
” “”}
Currently, what’s happening is, for example, estatecode, tenantcode and leasecode are blank, this is what is being generated, a blank line between Client and Property, and blank lines between Property and Inv Status:
Agent: Agent001 Agent Name
Client: Client001 Client NameProperty: Property001 Property Address
Inv Status: 001 Inv Status Description
What we would want is:
Agent: Agent001 Agent Name
Client: Client001 Client Name
Property: Property001 Property Address
Inv Status: 001 Inv Status Description
How can this be achieved in Aspose?