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

Insert Templates into one another #177

Open
muhammadaliawan opened this issue Oct 18, 2021 · 2 comments
Open

Insert Templates into one another #177

muhammadaliawan opened this issue Oct 18, 2021 · 2 comments

Comments

@muhammadaliawan
Copy link

muhammadaliawan commented Oct 18, 2021

Is there a way to let Sablon insert a template into another template?

This would be helpful in a scenario in which a group of templates require the same content with exact formattings etc.

What I am thinking is that we simply give the S3 url of a template(the template which is going to be inserted into another template is already uploaded on AWS S3 bucket) to Sablon object and it fetches that template from S3 and places its content in the resultant template.

@stadelmanma
Copy link
Collaborator

Hi @muhammadaliawan I attempted to implement this a few years ago. It turned out to be very difficult because certain components of word documents exist in different places (e.g. lists, images, styles, to name a few). Since we were operating in a Ruby on Rails app, I chose to take advantage of its HTML rendering system instead and spread my complex reports across several HTML template partials. Then I used the ERB templating machinery to handle creating a final HTML blob to insert into the template.

If you really want to go this route you could accomplish something similar by extracting the relevant XML nodes from your “template document” and then using WordML content insertion.

@muhammadaliawan
Copy link
Author

Okay, I will look into it. Thanks.

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