New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor method change_cell_style in zcl_excel_worksheet #904
refactor method change_cell_style in zcl_excel_worksheet #904
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There seems to be a regression with an export parameter and a couple of commented-out methods I cannot understand.
Program for testing the REPORT.
DATA: lo_excel TYPE REF TO zcl_excel,
lo_worksheet TYPE REF TO zcl_excel_worksheet.
CONSTANTS: gc_save_file_name TYPE string VALUE 'PR_904.xlsx'.
INCLUDE zdemo_excel_outputopt_incl.
START-OF-SELECTION.
CREATE OBJECT lo_excel.
lo_worksheet = lo_excel->get_active_worksheet( ).
lo_worksheet->set_cell( ip_column = 1 ip_row = 1 ip_value = 'A1' ).
lo_worksheet->set_cell( ip_column = 2 ip_row = 1 ip_value = 'B1' ).
lo_worksheet->set_cell( ip_column = 3 ip_row = 1 ip_value = 'C1' ).
DATA(lv_guid) = lo_worksheet->change_cell_style(
ip_column = 1
ip_row = 1
ip_fill_filltype = zcl_excel_style_fill=>c_fill_solid
ip_fill_fgcolor_rgb = zcl_excel_style_color=>c_yellow ).
lo_worksheet->set_cell_style( ip_column = 2 ip_row = 1 ip_style = lv_guid ).
DATA(lv_guid2) = lo_worksheet->change_cell_style(
ip_column = 1
ip_row = 1
ip_font_color_rgb = zcl_excel_style_color=>c_red ).
lo_worksheet->set_cell_style( ip_column = 3 ip_row = 1 ip_style = lv_guid2 ).
lcl_output=>output( lo_excel ). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Creation of new class
zcl_excel_style_changer
and refactor ofchange_cell_style
to use it. There's no fix, no feature change, it helps to go towards #524.Future plan: with this new class, it will be easy to create a new method
change_area_style
so that to change the style of many cells at a time. That would permit to rewritezdemo_excel40
, for the exact same result, instead of callingset_cell
andchange_cell_style
repeatedly for each cell in 100 rows * 20 columns, the methodsset_area
andchange_area_style
could be called once: