문제

I am sending collections form letters out, and one of the lines is "Your current debt is (merged data)." If the merged data amount is $0.00, I want to completely remove that sentence from the letter. Is that possible?

For instance, instead of:

Your account number: (123456)

Your last active date: (1/2/13)

Your current debt is: ($0.00)

Your sales to date are: ($12.34)

It would read:

Your account number: (123456)

Your last active date: (1/2/13)

Your sales to date are: ($12.34)

The merged data is illustrated in parenthesis for that example. The rest is normal text. Any ideas?

도움이 되었습니까?

해결책

Let's say the merge field with the amount is called myamount and contains 0.00

One way - you put the entire paragraph inside an IF field like this:

{ IF { MERGEFIELD myamount } = 0 "" "
Your current debt is: { MERGEFIELD myamount \#$,0.00 }" }

where all the {} have to be the special field code braces you can insert using ctrl-F9 on Windows Word.

i.e. you need to press Enter immediately before the word "Your" so that you get a paragraph mark at the beginning of the text when it is present.

If you need to have different output depending on whether the amount is positive or negative, you can use the facilities of the # numeric formatting switch (they are described in Microsoft's documentation).

다른 팁

I'm not sure that is possible with Mail Merge (actually I really doubt it is)

I am the leader of DocxGenJS, you could use that.

Here's a post about a possible solution: Hide/Remove Text Depending of Data in Docx

The template would look like this:

Your account number: {accountNumber}

Your last active date: {lastActiveDate}

{#debtShow} Your current debt is: {currentDebt} {/debtShow}

Your sales to date are: {salesToDate}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top