Reporting Engine / REF Fields update

Hi,



I try to use REF Fields in Word Template that will be automatically shown or disabled with Reporting Engine IF-clauses.



The Problem is the REF-Fields would not be Updated. Please have a look to the attached demo program.



Thanks for your help.

Best Regards,

Dirk.

Hi Dirk,


Thanks for your inquiry. This seems to be an expected behavior. Please generate 5 documents i.e. OutputA.docx, OutputB.docx ~ OutputE.docx using Aspose.Words for .NET 16.1.0. Now, open every output document using MS Word 2016, press Ctrl+A and then F9 to update all fields. You’ll observe that nothing happens against these REF fields for some documents and for some it renders “Error! Reference source not found.”. Aspose.Words mimics MS Word 2016 in this case. If we can help you with anything else, please feel free to ask.

Best regards,

Hi Awais,



I don’t think that this would be the expected behavior.



The references of the input file are all working without error message also when update via MS Word.



Output-File-A (All reference parts are available): OK



Output-File-B (Ref A - diabled by if clause) : NOK : Error Message for Ref B (1.1)



Output-File-C (Ref B - diabled by if clause) : NOK : Error Message for Ref C (1.2)



Output-File-D (Ref C - diabled by if clause) : OK



Output-File-E (Ref A and B - diabled by if clause) : NOK : Error Message for Ref C (1.1)



If i delete manually the parts from input file and update fields in MS Word. All references are OK.



Also it would be nice if we don’t need MS Word to update the field references after Reporting Engine has removed some references with if clauses. Is this possible?



Thanks for your help.

Best regards,

Dirk.

Hi Dirk,


Thanks for your inquiry. For the sake of any corrections, we have logged this problem in our issue tracking system as WORDSNET-13216. Our product team will further look into the details of this problem and we will keep you updated on the status of this issue. We apologize for your inconvenience.

Best regards,
Hi Dirk,

This turns out to be an expected behavior rather than a bug in Aspose.Words. There are the following notes though:

1. In contrast to Mail Merge, LINQ Reporting Engine has nothing to do with MS Word fields. So, you want to update REF fields using Aspose.Words, then you should call Document.UpdateFields explicitly after calling ReportingEngine.BuildReport.

2. Your Input.docx template contains bookmark starts in false-if parts and hence these bookmark starts are removed while processing. This is an expected behavior, however, it makes corresponding REF fields to be updated in a way that is not expected by you (with error messages). We have modified your template moving bookmark starts outside false-if parts (see InputModified.docx in attachments), which resolves your issue.

3. In general, LINQ Reporting Engine tags are not intended to be mixed with MS Word fields. Of course, for some field types like PAGE there are no alternatives. But for more complex scenarios (like this one), it is recommended to avoid mixing of LINQ Reporting Engine tags with MS Word fields. So, if you are interested in how your scenario can be covered without using of REF fields, please let us know and we will provide an example.

Best regards,
Hi Awais,

many thanks for your help.

Now I see where the problem is..


With
  • .UpdateListLabels();
and
  • .UpdateFields();
it is working perfect.

Thanks.
Best regards,
Dirk.


The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan