mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-03-02 10:44:28 +08:00
Merge pull request #2773 from urbanrotnik/ur-sci-4879-word-format-fix
Fix word reports when using headings [SCI-4879]
This commit is contained in:
commit
f5ffd685d8
1 changed files with 11 additions and 6 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue