We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Using IF statements with 8.1

I’m using the following IF statements in the MS Word template and getting the following results:


Template:
{IF “{MERGEFIELD GRADUATED}” <> “True” “DID NOT GRADUATE” “GRADUATED”}

Output:
{IF “True” <> “True” “DID NOT GRADUATE” “GRADUATED”}

Template:
{IF “{MERGEFIELD CLEARANCETYPE}” <> “” “{MERGEFIELD CLEARANCETYPE}” “NONE” }

Output:
{IF “” <> “” “” “NONE”}

I’m calling doc.UpdateFields(), but it appears that the MERGEFIELD databound items are updating, but the condition isn’t evaluating. I’ve tried “cntrl-A F9” and that doesn’t update the output document. I’ve tried using a more simple version.

Template:
{IF “{MERGEFIELD GRADUATED}” = “False” “DID NOT GRADUATE” }

Output:

{IF “True” = “False” “DID NOT GRADUATE” }

Template:

{IF “{MERGEFIELD CLEARANCETYPE}” = “” “NONE” }



Output:

{IF “” = “” “NONE”}

I’ve been reading through the forums for an answer, but it seems like this should work. There are spaces between the operator and the data fields and the values are quoted.

All of the other mergefield and regions work perfect, just not these IF statements. Any ideas?



Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. Could you please attach sample document and provide code example here? I will check the issue on my side and provide you more information.

Best regards.

Attached Input Template.doc, Output_Document.doc, and vb_code.txt. Code is in VB.NET for ASP.NET. I cut the code and template down to the basic problem areas and left a few other fields there just to make sure everything is okay.

The output_document.doc is the result of using the attached code with the attached template document.

thanks

D’oh.

I think I figured it out. I just needed to Toggle Field Display in Word…