Skip to content
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

> I assume you can't replace the ${colorlist} variable with a Java collection type as the .variableReplace() method of docx4j has the following signature public void variableReplace(java.util.Map<String, String> mappings) throws JAXBException, Docx4JException and is therefor expecting a Map<String, String>. #11

Closed
sathish38 opened this issue Dec 16, 2019 · 1 comment

Comments

@sathish38
Copy link

I assume you can't replace the ${colorlist} variable with a Java collection type as the .variableReplace() method of docx4j has the following signature public void variableReplace(java.util.Map<String, String> mappings) throws JAXBException, Docx4JException and is therefor expecting a Map<String, String>.

If you just want to render the content of your List, you can do the following:

 variables.put("colorlist", Arrays.asList("blue", "red", "white").stream().collect(Collectors.joining(", ")));

and the output on the document should be: blue, red, white.

Otherwise please have a look at the library itself or ask the question again on StackOverflow.

Hi rieckpil,
I want to iterate it by one by one like this
1.blue
2.red
3.white
what I want to do change in my template so far I used the foreach in the template but it doesnt works

Originally posted by @sathish38 in #9 (comment)

@rieckpil
Copy link
Owner

duplicate for #9. Please have a look at the library itself or ask the question again on StackOverflow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants