Merge pull request from urbanrotnik/ur-sci-4879-word-format-fix

Fix word reports when using headings [SCI-4879]
This commit is contained in:
Urban Rotnik 2020-08-11 13:01:43 +02:00 committed by GitHub
commit f5ffd685d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -19,12 +19,17 @@ module Reports::Docx::PrivateMethods
tiny_mce_table(elem[:data])
elsif elem[:type] == 'newline'
style = elem[:style] || {}
@docx.p elem[:value] do
align style[:align]
color style[:color]
bold style[:bold]
italic style[:italic]
style style[:style] if style[:style]
# print heading if its heading
# Mixing heading with other style setting causes problems for Word
if %w(h1 h2 h3 h4 h5).include?(style[:style])
@docx.public_send(style[:style], elem[:value])
else
@docx.p elem[:value] do
align style[:align]
color style[:color]
bold style[:bold]
italic style[:italic]
end
end
elsif elem[:type] == 'image'
Reports::Docx.render_img_element(@docx, elem)