-
Notifications
You must be signed in to change notification settings - Fork 354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for nested Object and scoping #149
Comments
You should probably use a custom parser http://docxtemplater.readthedocs.org/en/latest/configuration.html#custom-parser. |
For conditional formatting, use http://docxtemplater.readthedocs.org/en/latest/syntax.html#raw-xml-syntax |
Thanks! But i got that to work just by using the default parser, which is cool. But is there a way to add a newline character using a special character? I've tried using "/n" but it doesnt render. |
For adding new lines, see #144 |
How did you got it to work ? I believe everything is solved now so I'm closing this |
I had to modify the object (scope/context) that i'm passing to setData, so that I won't need angular's functionality; so for "item.attributeX.attributeY" to work, i simply pushed attributeY to item, that way i won't need to use a scope variable item, so the template looks as simple as this: from: It worked so I'm happy about it regardless. Thanks! |
is this possible to do? i am referring to the initial request of this issue. i've noticed some instances where if an object within a nested loop has the same tag property as one in the parent loop, the scope refers up to the parent instead of the child. in this case the child would be "this" |
The rule is that docxtemplater takes the parent scope whenever the childscope returns null or undefined. |
Is this something that can be avoided with nullGetter or a custom parser? I tried several things but no luck |
Can you explain in detail what your template is, data , and expected/actual output ? |
Yes, changing the custom parser could help, but without an idea of what your data looks like, it is quite difficult to give a better response. |
Suppose I needed to create a word file to show this javascript object:
{
"title": "Something something dark side",
"sections": [
{
"title": "Yoda's inner dark side"
"chapters":[
{"title": "Something about darkness","description": "There's something about the darkness"},
{ "title": "So dark out there","description": "It is very dark outside, i swear" },
]
}
]
}
How do i set up a scope temporary variable, like:
{#sections as section}
{#section.chapters as chapter}
{/chapters}
{/sections}
and is there a way to integrate conditional formatting?
The text was updated successfully, but these errors were encountered: