docx-stamper icon indicating copy to clipboard operation
docx-stamper copied to clipboard

repeatTableRow does not replace expressions

Open NNowakowski opened this issue 6 years ago • 5 comments

I've got a problem using repeatTableRow in my document. Here's what I setup: image

While my object looks like this: image

The dto in the list is build like this: image

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.

NNowakowski avatar Jan 03 '19 12:01 NNowakowski

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.

ImanGharib avatar Jan 04 '19 07:01 ImanGharib

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

lujop avatar Jan 04 '19 08:01 lujop

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

NNowakowski avatar Jan 04 '19 08:01 NNowakowski

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?

NNowakowski avatar Jan 04 '19 08:01 NNowakowski

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

lujop avatar Jan 04 '19 11:01 lujop