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

Free Support Forum - aspose.com

Variables declared in document header when using Linq Reporting Engine are not working anymore in version 21.10

Please see attached “DocTemplateVariableScopeIssue.docx” document template which declares a “myHeaderVariable” variable in the document header to be used with the Linq Reporting Engine inside the document. In version 21.7 of Aspose.Words, this variable could be used in the body of the document without a problem, see attached, generated document “DocTemplateVariableScopeIssue_Generated_v21.7.docx” and screenshot “DocTemplateVariableScopeIssue_Generated_v21.7.png.” In version 21.10 of Aspose.Words, this functionality broke, so we have many document templates that do not work anymore. See attached, generated document “DocTemplateVariableScopeIssue_Generated_v21.10.docx” and screenshot “DocTemplateVariableScopeIssue_Generated_v21.10.png.” (generated from the same “DocTemplateVariableScopeIssue.docx” document template).

Can you please fix this bug or suggest a workaround.

DocTemplateVariableScopeIssue.docx (13.6 KB)

DocTemplateVariableScopeIssue_Generated_v21.7.docx (9.9 KB)

DocTemplateVariableScopeIssue_Generated_v21.7.png (4.8 KB)

DocTemplateVariableScopeIssue_Generated_v21.10.docx (9.9 KB)

DocTemplateVariableScopeIssue_Generated_v21.10.png (4.8 KB)

@ted-1

We are working over your query and will get back to you soon.

@ted-1,
We have tested the scenario and managed to reproduce the same issue at our side. This issue appears because of new template reader’s behavior, added in version 21.9. Starting from this version, body of the document processes before headers/footers, so you can’t use variables, declared in document header, in document body.
For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET - 22967. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Hi, I see WORDSNET-22967 ---- Status : Closed, but how to I link to this issue to see how it was resolved?

@ted-1,
The issue is already resolved in the current codebase. The fix will be available in the next version of Aspose.Words, which is to be released in about a week.

After Aspose.Words 21.12 is released, you can apply ReportBuildOptions.UseLegacyHeaderFooterVisiting to get results compatible with older versions of Aspose.Words.

The issues you have found earlier (filed as WORDSNET-22967) have been fixed in this Aspose.Words for .NET 21.12 update also available on NuGet.