Thank you! We will try new feature!
ilianor
@ilianor
Posts made by ilianor
-
RE: Informative error message for docx templates
-
Informative error message for docx templates
Hello!
We have many tables in our docx templates. In almost every column of the table, there is a call to data, some helper, or special operators, such as:
{{#docxTable data as |line|}}{{line.name}}...
And we often encounter errors because docx editors automatically insert line breaks, breaking these constructs:
{{#docxTable data as |line|}}{{line.name}}
Which can lead to such errors:
2025-02-28T10:06:33.970Z - warn: Error when processing render request 5 (because) error while executing docx recipe (because) cannot read properties of null (reading '0') TypeError: Cannot read properties of null (reading '0')
The problem is that the error always looks exactly the same, and it’s unclear where in the template it occurs. Because of this, we spend a lot of time searching line by line, and downloading template to jsReport, for extra line breaks or spaces.
An additional complication arises because not all line breaks cause such errors. In some cases, the template breaks, while in others, it doesn’t.Is there a way to make the error more informative so that we don’t waste so much time searching line by line for the problem?
Thank you!
-
RE: Output multidimensional array in table using DOCX
Yes, my bad. I had to show this detail in my demo.
After some discussion we decided to use docxHtml function.
Using helpers we creating a string with dynamic html code, where we can managing columns using "td" tags. Then we just call this html string using docxHtml function in template document.
It is seems like better way for now.
But if something go wrong, I will return to this discussion.
@bjrmatos thank you for assist! -
RE: Output multidimensional array in table using DOCX
Hi @bjrmatos !
Thanks for the exampe! I tried such desigion with flatten structure. But the problem with such way is in the dynamic column quantity.
I need different column quantity it the row dependence on data of current data level. And I cant resolve it for column, only for row (for table). For row with one column it is ok, but for multiple...
Dont you know some way to resolve such issue with dynamic column number? -
RE: Output multidimensional array in table using DOCX
Thank you! I will wait for any news
-
RE: Output multidimensional array in table using DOCX
Hi @bjrmatos !
I cant give you our template for production, but here is the example that show you this issue.
We have the similar data structure in our project, with 3 array depth.
We need this to look like one table without nestingSorry, for some reason I cant upload demo, but here is the link on export archive
https://dropmefiles.com/1wU03Thank you!
-
Output multidimensional array in table using DOCX
Hello!
There is a problem with my docx report when I tried to output multidimensional array in table.
When I loop through arrays in a table I see vertical indents which ruins the effect of a single table.
Is there a way to solve this problem without flatting array?