mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-29 03:35:25 +08:00
Fix docx table generator if metadata are nil [SCI-8165]
This commit is contained in:
parent
64441f791f
commit
8bf9e2425b
1 changed files with 5 additions and 3 deletions
|
@ -8,10 +8,12 @@ module Reports::Docx::DrawResultTable
|
|||
obj = self
|
||||
@docx.p
|
||||
@docx.table JSON.parse(table.contents_utf_8)['data'], border_size: Constants::REPORT_DOCX_TABLE_BORDER_SIZE do
|
||||
JSON.parse(table.metadata)['cells'].each do |cell|
|
||||
next unless cell.present? && cell['row'].present? && cell['col'].present? && cell['className'].present?
|
||||
if table.metadata.present?
|
||||
JSON.parse(table.metadata)['cells']&.each do |cell|
|
||||
next unless cell.present? && cell['row'].present? && cell['col'].present? && cell['className'].present?
|
||||
|
||||
cell_style rows.dig(cell['row'].to_i, cell['col'].to_i), align: obj.table_cell_alignment(cell['className'])
|
||||
cell_style rows.dig(cell['row'].to_i, cell['col'].to_i), align: obj.table_cell_alignment(cell['className'])
|
||||
end
|
||||
end
|
||||
end
|
||||
@docx.p do
|
||||
|
|
Loading…
Reference in a new issue