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

replaceImage fails in certain cases #163

Closed
sfeurerbuteo opened this issue Jul 11, 2024 · 2 comments
Closed

replaceImage fails in certain cases #163

sfeurerbuteo opened this issue Jul 11, 2024 · 2 comments
Labels
bug Something isn't working functions images embedding dynamic images in templates

Comments

@sfeurerbuteo
Copy link

Describe the bug
Apparently there are different ways an image is embedded in a docx file. To my knowledge the user can not influence the way the image is embedded.

  • as grapic inside a drawing. (see good.docx) This works well with stencil
  • as shape inside a pict (see noGood.docx). Stencil fails with message:

"Did not find image to replace. The location of target image must precede the replaceImage() function call location."

To Reproduce
Run attached data.json against good.docx / noGood.docx

Expected behavior
stencil to support both image emedding methods

Documents
Not applicable, since rendering fails

Environment where template is rendered:

  • Stencil version: 0.5.8

  • Java version: 11

  • Operating System version: Linux

Additional context
I am refactoring some existing templates to work with stencil. So there might be some "garbage" in the docx files :)
Thanks for your awesome work on stencil

@erdos erdos added bug Something isn't working images embedding dynamic images in templates functions labels Jul 12, 2024
@erdos
Copy link
Owner

erdos commented Jul 14, 2024

Thanks for the detailed bug report! The example files made it really simple to address the issue in 510635e . I have released version 0.5.9 with the fix. Let me know if you find any other problems with it.

@sfeurerbuteo
Copy link
Author

Thanks for the very quick reaction and the fix.
Looks good on my initial tests.
I can tell more once i have tested some more of our templates, but this can take some time, with summer holidays etc.

Thanks again!

@erdos erdos closed this as completed Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working functions images embedding dynamic images in templates
Projects
None yet
Development

No branches or pull requests

2 participants