diff --git a/app/services/reports/docx/draw_result_table.rb b/app/services/reports/docx/draw_result_table.rb index ae3588f43..3d4d95392 100644 --- a/app/services/reports/docx/draw_result_table.rb +++ b/app/services/reports/docx/draw_result_table.rb @@ -9,7 +9,9 @@ module Reports::Docx::DrawResultTable @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| - cell_style rows[cell['row']][cell['col']], align: obj.table_cell_alignment(cell['className']) + if rows[cell['row'].to_i].present? + cell_style rows[cell['row']][cell['col']], align: obj.table_cell_alignment(cell['className']) + end end end @docx.p do diff --git a/app/services/reports/docx/draw_step_table.rb b/app/services/reports/docx/draw_step_table.rb index 35b72ae74..b47e0839b 100644 --- a/app/services/reports/docx/draw_step_table.rb +++ b/app/services/reports/docx/draw_step_table.rb @@ -10,7 +10,9 @@ module Reports::Docx::DrawStepTable if table.metadata table.metadata['cells'].each do |cell| data = cell[1] - cell_style rows[data['row'].to_i][data['col'].to_i], align: obj.table_cell_alignment(data['className']) + if rows[data['row'].to_i].present? + cell_style rows[data['row'].to_i][data['col'].to_i], align: obj.table_cell_alignment(data['className']) + end end end end