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

Injecting text-align: justify into docx file #189

Open
apfrozis opened this issue Jan 4, 2024 · 0 comments
Open

Injecting text-align: justify into docx file #189

apfrozis opened this issue Jan 4, 2024 · 0 comments

Comments

@apfrozis
Copy link

apfrozis commented Jan 4, 2024

I'm trying to inject the following html paragraph to a docx file I'm getting an error when opening it:

test

What I've figure out is that sablon, apparently, is not supporting text-align: justify style injection into the file. Because if I change it to "left", "center" or "right" it works perfectly.

This is what I'm doing to inject info to the template:

html_content = Sablon.content(:html, <p style="text-align: justify">test</p>)
template = Sablon.template(<template_path>)
output_docx = Tempfile.new([<project_name>, '.docx'])
context = {test_label: html_content}
template.render_to_file output_docx.path, context
output_docx.close

This is the template file:
image

When I try to open the generated file I get the following error:
image

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

1 participant