Free Support Forum - aspose.com

SUM Field with null value : InvalidOperationException

Hi,

I'm getting an InvalidOperationException on MailMerge.Execute() :

My template look like this :

{ = SUM({MERGEFIELD dtrecepsi \@ "yyyyy"},1) }

If my datasource has dtrecepsi null, InvalidOperationException is thrown.

I tried as workaround to add a IF field like this :

{ IF {MERGEFIELD dtrecepsi } = "" "" "{ = SUM({MERGEFIELD dtrecepsi \@ "yyyyy"},1) }" }

But the same error is thrown.

What is the best way to do that ?

Could Aspose.Word just ignore empty value in sum fields ?

{ = SUM(,1) } => { = SUM(0,1) }

And I don't understand why the error is thrown on MailMerge.execute() instead of UpdateFields. Did I miss something ?

Thanks for your help

(template and dataset are attached)

code :

Aspose.Words.License Lica = new Aspose.Words.License();
Lica.SetLicense(@\\fidji\Travail\venayre-m\N03\Aspose.Total.lic);
Document doc_out = new Document(Path.Combine(path,"template.doc"));
DataSet ds = new DataSet();
ds.ReadXml(Path.Combine(path, "dataset.xml"),XmlReadMode.ReadSchema);
doc_out.MailMerge.Execute(ds.Tables[0]);
doc_out.UpdateFields();

Hi

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

Thank you for reporting this problem to us. I managed to reproduce the problem on my side. Your request has been linked to the appropriate issue. You will be notified as soon as it is fixed.

Best regards,

Thanks for your quick reply !

The issues you have found earlier (filed as WORDSNET-3719) have been fixed in this .NET update and in this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.