Skip to content
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

get_print_repeat_rows/get_print_repeat_columns return initial values after reading existing Excel file #801

Closed
sandraros opened this issue Sep 19, 2021 · 0 comments · Fixed by #862
Assignees
Labels

Comments

@sandraros
Copy link
Collaborator

sandraros commented Sep 19, 2021

Given this Excel file "bug_print_repeat.xlsx" with rows and columns defined as to be repeated in each printed page (menu Page Layout > Print Titles > Rows to repeat at top = $1:$1 and Columns to repeat at left =$A:$A):
image

The following program reads the file but doesn't get the information (first popup displays "Repeat rows: 0:0; Repeat columns: :"), the expected result is "Repeat rows: 1:1; Repeat columns: A:A".

For information, the two methods get_print_repeat_rows and get_print_repeat_columns work only after calling explicitly the methods set_print_repeat_rows and set_print_repeat_columns (second popup displays "Repeat rows: 1:1; Repeat columns: A:A").

Program to reproduce the issue:

REPORT.
PARAMETERS p_upfile TYPE string LOWER CASE DEFAULT 'C:\Temp\bug_print_repeat.xlsx'.
DATA gc_save_file_name TYPE string VALUE 'bug_print_repeat2.xlsx'.
INCLUDE zdemo_excel_outputopt_incl.
INITIALIZATION.
  p_path = 'C:\Temp'.
START-OF-SELECTION.
  TRY.
      DATA(reader) = NEW zcl_excel_reader_2007( ).
      DATA(excel) = reader->zif_excel_reader~load_file( p_upfile ).
      DATA(sheet) = excel->get_active_worksheet( ).
      sheet->zif_excel_sheet_printsettings~get_print_repeat_columns(
        IMPORTING
          ev_columns_from = DATA(ev_columns_from)
          ev_columns_to   = DATA(ev_columns_to) ).
      sheet->zif_excel_sheet_printsettings~get_print_repeat_rows(
        IMPORTING
          ev_rows_from = DATA(ev_rows_from)
          ev_rows_to   = DATA(ev_rows_to) ).
      MESSAGE |Repeat rows: { ev_rows_from }:{ ev_rows_to }; Repeat columns: { ev_columns_from }:{ ev_columns_to }| TYPE 'I'.
      sheet->zif_excel_sheet_printsettings~set_print_repeat_rows(
          iv_rows_from = 1
          iv_rows_to   = 1 ).
      sheet->zif_excel_sheet_printsettings~set_print_repeat_columns(
          iv_columns_from = 'A'
          iv_columns_to   = 'A' ).
      sheet->zif_excel_sheet_printsettings~get_print_repeat_columns(
        IMPORTING
          ev_columns_from = ev_columns_from
          ev_columns_to   = ev_columns_to ).
      sheet->zif_excel_sheet_printsettings~get_print_repeat_rows(
        IMPORTING
          ev_rows_from = ev_rows_from
          ev_rows_to   = ev_rows_to ).
      MESSAGE |Repeat rows: { ev_rows_from }:{ ev_rows_to }; Repeat columns: { ev_columns_from }:{ ev_columns_to }| TYPE 'I'.
      lcl_output=>output( excel ).
    CATCH cx_root INTO DATA(lx_root).
      MESSAGE lx_root TYPE 'I' DISPLAY LIKE 'E'.
  ENDTRY.
bigld added a commit to cadaxo/abap2xlsx that referenced this issue Oct 14, 2021
@bigld bigld self-assigned this Oct 15, 2021
@sandraros sandraros added the bug label Oct 25, 2021
sandraros pushed a commit that referenced this issue Oct 30, 2021
* fix print titles range read and write

* remove empty line in method definition
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants