docx-stamper
docx-stamper copied to clipboard
repeatTableRow does not replace expressions
I've got a problem using repeatTableRow in my document.
Here's what I setup:
While my object looks like this:
The dto in the list is build like this:
However when I generate the document, I do get the following errors on the console:
Reason: EL1008E: Property or field 'baureihe' cannot be found on object of type 'FileExportAuditorDto' - maybe not public or not valid?. Set log level to TRACE to view Stacktrace.
Reason: EL1008E: Property or field 'menge' cannot be found on object of type 'FileExportAuditorDto' - maybe not public or not valid?. Set log level to TRACE to view Stacktrace.
Reason: EL1008E: Property or field 'budget' cannot be found on object of type 'FileExportAuditorDto' - maybe not public or not valid?. Set log level to TRACE to view Stacktrace.
Reason: EL1008E: Property or field 'gesamtBudget' cannot be found on object of type 'FileExportAuditorDto' - maybe not public or not valid?. Set log level to TRACE to view Stacktrace.
Seemingly the library tries to resolve baureihe, menge, budget and gesamtBudget on the main object, not on the dto I passed in as a list.
Did I miss some configuration or what else could be the issue?
Edit:
From the TRACE output it looks like the comment is processed once everything else has been filled with values. Could that be the cause?
Expression ${gesamtBudget} could not be resolved against context root of type class FileExportAuditorDto. Reason: EL1008E: Property or field 'gesamtBudget' cannot be found on object of type 'FileExportAuditorDto' - maybe not public or not valid?. Set log level to TRACE to view Stacktrace.
Comment 'repeatTableRow(baureiheBudgetMengeList)' has been successfully processed by a comment processor.
shouldn't you write repeatTableRow(fileExportAuditorDto.baureiheBudgetMengeList)? I have used it in the same scenario like this: repeatTableRow (genutzteDatenfelder.genutzteDatenfelderZeile) in which the first object contains a list from the second one and it works.
Did you use in combination with leaveEmptyOnExpressionError
?
I've detected a bug when you use repeatTableRow with that option and will publish a PR in the next hours
shouldn't you write repeatTableRow(fileExportAuditorDto.baureiheBudgetMengeList)? I have used it in the same scenario like this: repeatTableRow (genutzteDatenfelder.genutzteDatenfelderZeile) in which the first object contains a list from the second one and it works.
But there is no property named fileExportAuditorDto. The class I'm giving the library is named FileExportAuditorDto. This class contains a list named baureiheBudgetMengeList. The repeat comment itself works, since I can see 2 lines in the table, however the values of it are empty since it tries to resolve ${baureihe} etc. on the FileExportAuditorDto class, instead of the object behind baureiheBudgetMengeList
Did you use in combination with
leaveEmptyOnExpressionError
? I've detected a bug when you use repeatTableRow with that option and will publish a PR in the next hours
Thanks A LOT! Removing that line from my code actually fixed the problem. May I ask why this was causing an issue?
Loot at that commit I will try to do a PR today or in the nexts days as branch is not ready to merge now