Free Support Forum - aspose.com

Aspose.Word evaluation question

Hi,

I’m evaluating Aspose.Word for Java and have the following question:
Are merge fields supported in IF field (both in condition and result part).
E.g. how to make smth. like this work:
{ IF { FIELD_NAME1 }=1 “AAAAA”, “BBBB”}
and
{ IF { FIELD_NAME1 }=1 { FIELD_NAME2 } { FIELD_NAME3 } }
I tried several combinations but none of them seem to work.
I called also setUseNonMergeFields(true) but it had no effect either.

There was already a forum thread regarding IF support in 2005. Probably smth. changed since then.

Thank you and best regards,
Andrey.

Hi

Thanks for your interest in Aspose products. Unfortunately, at the moment Aspose.Words does not support conditional logic. I can’t tell you exact date when this feature will be available. Current estimate is sometime in 2008.

For more information see FAQ.

Best regards.

Hi Alexey,

thank you for the answer. What about this text from the documentation:
************************************************


Using Non-Merge Fields


		<p style="margin: 0pt 0pt 6pt;"><span style="font-family: 'Verdana'; font-size: 8.5pt;">Normally, mail merge is only performed into </span><span style="font-family: 'Verdana'; font-size: 8.5pt; font-style: italic;">MERGEFIELD</span><span style="font-family: 'Verdana'; font-size: 8.5pt;">

fields, but several customers had their reporting built using other
fields and had many documents created this way. To simplify migration
(and because this approach was independently used by several customers) the ability to mail merge into other fields was introduced.


When MailMerge.UseNonMergeFields is set to true, mail merge will be performed into the following fields:


MERGEFIELD FieldName



MACROBUTTON NOMACRO FieldName



IF 0 = 0 “{FieldName}” “”

***********************************************

The last “IF” : is smth. like this supported?

Thank you.
Andrey.


Hi

Thanks for this inquiry. You can use the following field and the following code..

{ IF 0 = 0 "{FieldName}" "test" \* MERGEFORMAT }

Document doc = new Document(@"343_101795_a.grin\in.doc");

string[] names = {"FieldName" };

string[] values = { "OK" };

doc.MailMerge.UseNonMergeFields = true;

doc.MailMerge.Execute(names, values);

doc.Save(@"343_101795_a.grin\out.doc");

But you can see that conditional expression (0=0) is calculated by word. This code will not evaluate conditional expression this code will only insert value.

Best regards.