Debug mailmerge exceptions

I have an issue where, a value in the datasource overflows, with the following exception:

System.OverflowException: Værdien var enten for stor eller for lille til en Int32.
ved System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
ved System.Int32.Parse(String s, NumberStyles style, IFormatProvider provider)
ved . (String )
ved ​ .(Table , String , Int32 )
ved .(Table , String , String )
ved .( , String , Boolean , & )
ved .( , String , Boolean , Boolean )
ved .(String , )
ved . (ArrayList , )
ved .(String )
ved .( , String , )
ved .( , String , )
ved .( , String )
ved .( )
ved .(Field , )
ved Aspose.Words.Fields.FieldIf.()
ved Aspose.Words.Fields.FieldIf.86q6acmbfp2kjwdcs2q6rs3uwmqt2zc9 ( )
ved ​ .( )
ved ​ .( )
ved ​ .( )
ved ​ .( )
ved ​ .( )
ved ​ .(​ , ​ )
ved ​ .(ArrayList )
ved .(ArrayList , ​ )
ved . ()
ved .( , Boolean )
ved Aspose.Words.MailMerging.MailMerge.( )
ved Aspose.Words.MailMerging.MailMerge.Execute(String[] fieldNames, Object[] values)

The only thing I can deduce from this, is that it is happening in a FieldIf statement,
however, it would be >really< helpful, if you would provide the value and/or name of the field in question.

When dealing with very large datasets, and complicated templates, finding the culprit in such cases is very time consuming… Especially since Microsoft Word doesn’t present an error.

Thank you.

Hi Jens,

Thanks for your inquiry. It would be great if you please share following detail for investigation purposes.

  • Please attach your input Word document.
  • Please create a standalone/runnable simple application (for example a Console Application Project) that demonstrates the code (Aspose.Words code) you used to generate your output document

Unfortunately, it is difficult to say what the problem is without the Document(s) and
simplified application. We need your Document(s) and simple project to
reproduce the problem. As soon as you get these pieces of information to
us we’ll start our investigation into your issue.

I worked out what went wrong in this particular case…

First; this is the merge segment that fails:

{IF { MERGEFIELD "field" } <> "" "{ MERGEFIELD "field" }" ""}

The value of “field” is “EANnummer:4002515616239”,
Type: System.String

This gets me the int32 overflow error;

If I edit the value to “EANnummer: 4002515616239” (note the whitespace after the colon), everything works.

Why you’re trying to convert the value to an int32, I can’t guess.

Hi Jens,

Thanks for your inquiry. Unfortunately, it is difficult to say what the problem is without the Document(s) and simplified application. We need your Document(s) and simple project to reproduce the problem. As soon as you get these pieces of information to us we’ll start our investigation into your issue.