{"action":"opened","issue":{"url":"https://api.github.com/repos/ivanfemia/abap2xlsx/issues/364","labels_url":"https://api.github.com/repos/ivanfemia/abap2xlsx/issues/364/labels{/name}","comments_url":"https://api.github.com/repos/ivanfemia/abap2xlsx/issues/364/comments","events_url":"https://api.github.com/repos/ivanfemia/abap2xlsx/issues/364/events","html_url":"https://github.com/ivanfemia/abap2xlsx/issues/364","id":60835646,"number":364,"title":"style at a merged cell ","user":{"login":"nxdiez","id":11442482,"avatar_url":"https://avatars.githubusercontent.com/u/11442482?v=3","gravatar_id":"","url":"https://api.github.com/users/nxdiez","html_url":"https://github.com/nxdiez","followers_url":"https://api.github.com/users/nxdiez/followers","following_url":"https://api.github.com/users/nxdiez/following{/other_user}","gists_url":"https://api.github.com/users/nxdiez/gists{/gist_id}","starred_url":"https://api.github.com/users/nxdiez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nxdiez/subscriptions","organizations_url":"https://api.github.com/users/nxdiez/orgs","repos_url":"https://api.github.com/users/nxdiez/repos","events_url":"https://api.github.com/users/nxdiez/events{/privacy}","received_events_url":"https://api.github.com/users/nxdiez/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-03-12T15:20:07Z","updated_at":"2015-03-12T15:20:07Z","closed_at":null,"body":"Let me say it is the first time I collaborate at GI, and I do not know how it works really well.\r\nI hope this is the right place to write.\r\nSecondly, I discovered ABAP2XLSX and it is awesome! Thank you, guys!\r\n\r\nWhile using ABAP2XLSX, I have faced that applying an style to a merged cell, it just affects to top-left cell of the group of cells, Checkin the example ZDEMO_EXCEL13, I see I had to apply the style to all the cells, and set the value to the top-left cell.\r\nIn my case, I had many merge cells, so I decided to create a new method SET_MERGE_STYLE on ZCL_EXCEL_WORKSHEET and modify SET_MERGE.\r\n\r\nBellow the code,\r\n1 - SET_MERGE_STYLE definition\r\n```abap\r\nmethods SET_MERGE_STYLE\r\n    importing\r\n      !IP_COLUMN_START type ZEXCEL_CELL_COLUMN_ALPHA optional\r\n      !IP_COLUMN_END type ZEXCEL_CELL_COLUMN_ALPHA optional\r\n      !IP_ROW type ZEXCEL_CELL_ROW optional\r\n      !IP_ROW_TO type ZEXCEL_CELL_ROW optional\r\n      !IP_STYLE type ZEXCEL_CELL_STYLE optional .\r\n```\r\n2 - SET_MERGE_STYLE implementation\r\n```abap\r\nMETHOD set_merge_style.\r\n  DATA: ld_row_start TYPE zexcel_cell_row,\r\n        ld_row_end TYPE zexcel_cell_row,\r\n        ld_column_start TYPE zexcel_cell_column,\r\n        ld_column_end TYPE zexcel_cell_column,\r\n        ld_current_column TYPE zexcel_cell_column_alpha,\r\n        ld_current_row type zexcel_cell_row.\r\n\r\n  MOVE: ip_row_to TO ld_row_end,\r\n        ip_row    TO ld_row_start.\r\n  IF ld_row_end IS INITIAL.\r\n    ld_row_end = ld_row_start.\r\n  ENDIF.\r\n  ld_column_start = zcl_excel_common=>convert_column2int( ip_column_start ).\r\n  ld_column_end   = zcl_excel_common=>convert_column2int( ip_column_end ).\r\n  IF ld_column_end IS INITIAL.\r\n    ld_column_end = ld_column_start.\r\n  ENDIF.\r\n  \"set the style cell by cell\r\n  WHILE ld_column_start <= ld_column_end.\r\n    ld_current_column = zcl_excel_common=>convert_column2alpha( ld_column_start ).\r\n    ld_current_row = ld_row_start.\r\n    WHILE ld_current_row <= ld_row_end.\r\n      me->set_cell_style( ip_row = ld_current_row ip_column = ld_current_column\r\n                          ip_style = ip_style ).\r\n      add 1 to ld_current_row.\r\n    ENDWHILE.\r\n    ADD 1 TO ld_column_start.\r\n  ENDWHILE.\r\nENDMETHOD.\r\n```\r\n3 - SET_MERGE definition\r\n```abap\r\nmethods SET_MERGE\r\n    importing\r\n      !IP_COLUMN_START type ZEXCEL_CELL_COLUMN_ALPHA optional\r\n      !IP_COLUMN_END type ZEXCEL_CELL_COLUMN_ALPHA optional\r\n      !IP_ROW type ZEXCEL_CELL_ROW optional\r\n      !IP_ROW_TO type ZEXCEL_CELL_ROW optional \r\n      !IP_STYLE type ZEXCEL_CELL_STYLE optional \"added parameter\r\n      !IP_VALUE type SIMPLE optional \"added parameter\r\n      !IP_FORMULA type ZEXCEL_CELL_FORMULA optional \"added parameter\r\n    raising\r\n      ZCX_EXCEL .\r\n```\r\n4 -  SET_MERGE Implementation\r\n```abap\r\n...\r\n\"just after variables definition\r\nif ip_value is supplied or ip_formula is supplied.\r\n\" if there is a value or formula set the value to the top-left cell\r\n\"maybe it is necessary to support other paramters for set_cell\r\n    if ip_value is supplied.\r\n      me->set_cell( ip_row = ip_row ip_column = ip_column_start\r\n                    ip_value = ip_value ).\r\n    endif.\r\n    if ip_formula is supplied.\r\n      me->set_cell( ip_row = ip_row ip_column = ip_column_start\r\n                    ip_value = ip_formula ).\r\n    endif.\r\n  endif.\r\n\"call to set_merge_style to apply the style to all cells at the matrix\r\n  IF ip_style IS SUPPLIED.\r\n    me->set_merge_style( ip_row = ip_row ip_column_start = ip_column_start\r\n                         ip_row_to = ip_row_to ip_column_end = ip_column_end\r\n                         ip_style = ip_style ).\r\n  ENDIF.\r\n...\r\n```\r\n\r\nWith this modification, I can set the value and style and merge all the cells at once, calling at set_merge\r\nSome examples\r\n```abap\r\n  lo_worksheet->set_merge( ip_column_start = 'A' ip_column_end = 'C'\r\n                        ip_row = 1\r\n                        ip_style = ld_style_cell_guid\r\n                        ip_value = '3 Cells 1 Row'\r\n                        ).\r\nlo_worksheet->set_merge( ip_column_start = 'A' ip_column_end = 'C'\r\n                        ip_row = 2  ip_row_to = 4\r\n                        ip_style = ld_style_cell_guid\r\n                        ip_value = '3 Cells 3 Rows'\r\n                        ).\r\n```\r\n\r\nRight now it works for my needs, but I am sure you find a better way to implement it, and many errors\r\n\r\nBest regards"}}