Merge branch 'abap2xlsx:main' into some-bugs-to-fix

This commit is contained in:
Bernd 2024-02-20 14:41:53 +01:00 committed by GitHub
commit bbbb389c83
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 65 additions and 45 deletions

View File

@ -186,7 +186,7 @@ Apache License
same "printed page" as the copyright notice for easier same "printed page" as the copyright notice for easier
identification within third-party archives. identification within third-party archives.
Copyright {yyyy} {name of copyright owner} Copyright 2010 abap2xlsx Contributors
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -204,7 +204,6 @@ CLASS zcl_excel_theme IMPLEMENTATION.
lo_document = lo_ixml->create_document( ). lo_document = lo_ixml->create_document( ).
lo_document->set_encoding( lo_encoding ). lo_document->set_encoding( lo_encoding ).
lo_document->set_standalone( abap_true ). lo_document->set_standalone( abap_true ).
lo_document->set_namespace_prefix( prefix = 'a' ).
lo_element_root = lo_document->create_simple_element_ns( prefix = c_theme_prefix lo_element_root = lo_document->create_simple_element_ns( prefix = c_theme_prefix
name = c_theme name = c_theme

View File

@ -2672,7 +2672,6 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION.
METHOD create_xl_drawings_vml. METHOD create_xl_drawings_vml.
DATA: DATA:
lo_xml_document TYPE REF TO cl_xml_document,
ld_stream TYPE string. ld_stream TYPE string.
@ -2683,11 +2682,6 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION.
* BODY * BODY
ld_stream = set_vml_string( ). ld_stream = set_vml_string( ).
CREATE OBJECT lo_xml_document.
CALL METHOD lo_xml_document->parse_string
EXPORTING
stream = ld_stream.
CALL FUNCTION 'SCMS_STRING_TO_XSTRING' CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING EXPORTING
text = ld_stream text = ld_stream
@ -3340,8 +3334,7 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION.
ls_odd_footer TYPE zexcel_s_worksheet_head_foot, ls_odd_footer TYPE zexcel_s_worksheet_head_foot,
ls_even_header TYPE zexcel_s_worksheet_head_foot, ls_even_header TYPE zexcel_s_worksheet_head_foot,
ls_even_footer TYPE zexcel_s_worksheet_head_foot, ls_even_footer TYPE zexcel_s_worksheet_head_foot,
lv_content TYPE string, lv_content TYPE string.
lo_xml_document TYPE REF TO cl_xml_document.
* INIT_RESULT * INIT_RESULT
@ -3389,11 +3382,6 @@ CLASS zcl_excel_writer_2007 IMPLEMENTATION.
ld_7 ld_7
INTO lv_content. INTO lv_content.
CREATE OBJECT lo_xml_document.
CALL METHOD lo_xml_document->parse_string
EXPORTING
stream = lv_content.
CALL FUNCTION 'SCMS_STRING_TO_XSTRING' CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING EXPORTING
text = lv_content text = lv_content

View File

@ -9,6 +9,9 @@ CLASS zcl_excel_writer_csv DEFINITION
INTERFACES zif_excel_writer . INTERFACES zif_excel_writer .
"! Default value for initial dates e.g. user's format (DD.MM.YYYY, MM.DD.YYYY, etc.)
CONSTANTS c_default TYPE c LENGTH 10 VALUE 'DEFAULT' ##NO_TEXT.
CLASS-METHODS set_delimiter CLASS-METHODS set_delimiter
IMPORTING IMPORTING
VALUE(ip_value) TYPE c DEFAULT ';' . VALUE(ip_value) TYPE c DEFAULT ';' .
@ -24,7 +27,10 @@ CLASS zcl_excel_writer_csv DEFINITION
CLASS-METHODS set_active_sheet_index_by_name CLASS-METHODS set_active_sheet_index_by_name
IMPORTING IMPORTING
!i_worksheet_name TYPE zexcel_worksheets_name . !i_worksheet_name TYPE zexcel_worksheets_name .
*"* protected components of class ZCL_EXCEL_WRITER_2007 CLASS-METHODS set_initial_ext_date
IMPORTING
!ip_value TYPE char10 DEFAULT c_default .
*"* protected components of class ZCL_EXCEL_WRITER_CSV
*"* do not include other source files here!!! *"* do not include other source files here!!!
PROTECTED SECTION. PROTECTED SECTION.
*"* private components of class ZCL_EXCEL_WRITER_CSV *"* private components of class ZCL_EXCEL_WRITER_CSV
@ -38,6 +44,7 @@ CLASS zcl_excel_writer_csv DEFINITION
eol TYPE c LENGTH 2 VALUE cl_abap_char_utilities=>cr_lf ##NO_TEXT. eol TYPE c LENGTH 2 VALUE cl_abap_char_utilities=>cr_lf ##NO_TEXT.
CLASS-DATA worksheet_name TYPE zexcel_worksheets_name . CLASS-DATA worksheet_name TYPE zexcel_worksheets_name .
CLASS-DATA worksheet_index TYPE zexcel_active_worksheet . CLASS-DATA worksheet_index TYPE zexcel_active_worksheet .
CLASS-DATA initial_ext_date TYPE char10 VALUE c_default.
METHODS create METHODS create
RETURNING RETURNING
@ -53,7 +60,7 @@ ENDCLASS.
CLASS zcl_excel_writer_csv IMPLEMENTATION. CLASS ZCL_EXCEL_WRITER_CSV IMPLEMENTATION.
METHOD create. METHOD create.
@ -220,6 +227,9 @@ CLASS zcl_excel_writer_csv IMPLEMENTATION.
CASE <fs_sheet_content>-data_type. CASE <fs_sheet_content>-data_type.
WHEN 'd' OR 'D'. WHEN 'd' OR 'D'.
IF <fs_sheet_content>-cell_value IS INITIAL AND initial_ext_date <> c_default.
lc_value = initial_ext_date.
ELSE.
lc_value = zcl_excel_common=>excel_string_to_date( ip_value = <fs_sheet_content>-cell_value ). lc_value = zcl_excel_common=>excel_string_to_date( ip_value = <fs_sheet_content>-cell_value ).
TRY. TRY.
lv_date = lc_value. lv_date = lc_value.
@ -238,6 +248,7 @@ CLASS zcl_excel_writer_csv IMPLEMENTATION.
CATCH cx_sy_conversion_no_number. CATCH cx_sy_conversion_no_number.
ENDTRY. ENDTRY.
ENDIF.
WHEN 't' OR 'T'. WHEN 't' OR 'T'.
lc_value = zcl_excel_common=>excel_string_to_time( ip_value = <fs_sheet_content>-cell_value ). lc_value = zcl_excel_common=>excel_string_to_time( ip_value = <fs_sheet_content>-cell_value ).
@ -302,6 +313,11 @@ CLASS zcl_excel_writer_csv IMPLEMENTATION.
ENDMETHOD. ENDMETHOD.
METHOD set_initial_ext_date.
initial_ext_date = ip_value.
ENDMETHOD.
METHOD zif_excel_writer~write_file. METHOD zif_excel_writer~write_file.
me->excel = io_excel. me->excel = io_excel.
ep_file = me->create( ). ep_file = me->create( ).

View File

@ -32,6 +32,11 @@
<LANGU>I</LANGU> <LANGU>I</LANGU>
<DESCRIPT>Create CSV ; Delimited format</DESCRIPT> <DESCRIPT>Create CSV ; Delimited format</DESCRIPT>
</SEOCOMPOTX> </SEOCOMPOTX>
<SEOCOMPOTX>
<CMPNAME>C_DEFAULT</CMPNAME>
<LANGU>E</LANGU>
<DESCRIPT>Constant for string &apos;DEFAULT&apos;</DESCRIPT>
</SEOCOMPOTX>
<SEOCOMPOTX> <SEOCOMPOTX>
<CMPNAME>DELIMITER</CMPNAME> <CMPNAME>DELIMITER</CMPNAME>
<LANGU>E</LANGU> <LANGU>E</LANGU>
@ -72,6 +77,11 @@
<LANGU>I</LANGU> <LANGU>I</LANGU>
<DESCRIPT>Excel creator</DESCRIPT> <DESCRIPT>Excel creator</DESCRIPT>
</SEOCOMPOTX> </SEOCOMPOTX>
<SEOCOMPOTX>
<CMPNAME>INITIAL_EXT_DATE</CMPNAME>
<LANGU>E</LANGU>
<DESCRIPT>Initial External Date</DESCRIPT>
</SEOCOMPOTX>
<SEOCOMPOTX> <SEOCOMPOTX>
<CMPNAME>SET_ACTIVE_SHEET_INDEX</CMPNAME> <CMPNAME>SET_ACTIVE_SHEET_INDEX</CMPNAME>
<LANGU>E</LANGU> <LANGU>E</LANGU>
@ -122,6 +132,11 @@
<LANGU>I</LANGU> <LANGU>I</LANGU>
<DESCRIPT>Set End Of Line character</DESCRIPT> <DESCRIPT>Set End Of Line character</DESCRIPT>
</SEOCOMPOTX> </SEOCOMPOTX>
<SEOCOMPOTX>
<CMPNAME>SET_INITIAL_EXT_DATE</CMPNAME>
<LANGU>E</LANGU>
<DESCRIPT>Set Initial External Date (replacing default &apos;00.00.0000&apos;)</DESCRIPT>
</SEOCOMPOTX>
<SEOCOMPOTX> <SEOCOMPOTX>
<CMPNAME>WORKSHEET_INDEX</CMPNAME> <CMPNAME>WORKSHEET_INDEX</CMPNAME>
<LANGU>E</LANGU> <LANGU>E</LANGU>
@ -143,6 +158,14 @@
<DESCRIPT>Worksheets name</DESCRIPT> <DESCRIPT>Worksheets name</DESCRIPT>
</SEOCOMPOTX> </SEOCOMPOTX>
</DESCRIPTIONS> </DESCRIPTIONS>
<DESCRIPTIONS_SUB>
<SEOSUBCOTX>
<CMPNAME>SET_INITIAL_EXT_DATE</CMPNAME>
<SCONAME>IP_VALUE</SCONAME>
<LANGU>E</LANGU>
<DESCRIPT>Input Value</DESCRIPT>
</SEOSUBCOTX>
</DESCRIPTIONS_SUB>
</asx:values> </asx:values>
</asx:abap> </asx:abap>
</abapGit> </abapGit>

View File

@ -262,8 +262,7 @@ CLASS zcl_excel_writer_xlsm IMPLEMENTATION.
lo_ostream TYPE REF TO if_ixml_ostream, lo_ostream TYPE REF TO if_ixml_ostream,
lo_renderer TYPE REF TO if_ixml_renderer. lo_renderer TYPE REF TO if_ixml_renderer.
DATA: lv_subrc TYPE sysubrc, DATA: lv_contenttype TYPE string.
lv_contenttype TYPE string.
********************************************************************** **********************************************************************
* STEP 3: Create standard contentType * STEP 3: Create standard contentType
@ -273,7 +272,7 @@ CLASS zcl_excel_writer_xlsm IMPLEMENTATION.
* STEP 2: modify XML adding the extension bin definition * STEP 2: modify XML adding the extension bin definition
CREATE OBJECT lo_document_xml. CREATE OBJECT lo_document_xml.
lv_subrc = lo_document_xml->parse_xstring( ep_content ). lo_document_xml->parse_xstring( ep_content ).
lo_document ?= lo_document_xml->m_document. lo_document ?= lo_document_xml->m_document.
lo_element_root = lo_document->if_ixml_node~get_first_child( ). lo_element_root = lo_document->if_ixml_node~get_first_child( ).
@ -342,7 +341,6 @@ CLASS zcl_excel_writer_xlsm IMPLEMENTATION.
DATA: lv_xml_node_ridx_id TYPE string, DATA: lv_xml_node_ridx_id TYPE string,
lv_size TYPE i, lv_size TYPE i,
lv_subrc TYPE sysubrc,
lv_syindex(2) TYPE c. lv_syindex(2) TYPE c.
********************************************************************** **********************************************************************
@ -353,7 +351,7 @@ CLASS zcl_excel_writer_xlsm IMPLEMENTATION.
* STEP 2: modify XML adding the vbaProject relation * STEP 2: modify XML adding the vbaProject relation
CREATE OBJECT lo_document_xml. CREATE OBJECT lo_document_xml.
lv_subrc = lo_document_xml->parse_xstring( ep_content ). lo_document_xml->parse_xstring( ep_content ).
lo_document ?= lo_document_xml->m_document. lo_document ?= lo_document_xml->m_document.
lo_element_root = lo_document->if_ixml_node~get_first_child( ). lo_element_root = lo_document->if_ixml_node~get_first_child( ).
@ -406,8 +404,6 @@ CLASS zcl_excel_writer_xlsm IMPLEMENTATION.
lo_ostream TYPE REF TO if_ixml_ostream, lo_ostream TYPE REF TO if_ixml_ostream,
lo_renderer TYPE REF TO if_ixml_renderer. lo_renderer TYPE REF TO if_ixml_renderer.
DATA: lv_subrc TYPE sysubrc.
********************************************************************** **********************************************************************
* STEP 3: Create standard relationship * STEP 3: Create standard relationship
ep_content = super->create_xl_sheet( io_worksheet = io_worksheet ep_content = super->create_xl_sheet( io_worksheet = io_worksheet
@ -417,7 +413,7 @@ CLASS zcl_excel_writer_xlsm IMPLEMENTATION.
* STEP 2: modify XML adding the vbaProject relation * STEP 2: modify XML adding the vbaProject relation
CREATE OBJECT lo_document_xml. CREATE OBJECT lo_document_xml.
lv_subrc = lo_document_xml->parse_xstring( ep_content ). lo_document_xml->parse_xstring( ep_content ).
lo_document ?= lo_document_xml->m_document. lo_document ?= lo_document_xml->m_document.
lo_element_root = lo_document->if_ixml_node~get_first_child( ). lo_element_root = lo_document->if_ixml_node~get_first_child( ).
@ -458,8 +454,6 @@ CLASS zcl_excel_writer_xlsm IMPLEMENTATION.
lo_ostream TYPE REF TO if_ixml_ostream, lo_ostream TYPE REF TO if_ixml_ostream,
lo_renderer TYPE REF TO if_ixml_renderer. lo_renderer TYPE REF TO if_ixml_renderer.
DATA: lv_subrc TYPE sysubrc.
********************************************************************** **********************************************************************
* STEP 3: Create standard relationship * STEP 3: Create standard relationship
ep_content = super->create_xl_workbook( ). ep_content = super->create_xl_workbook( ).
@ -468,7 +462,7 @@ CLASS zcl_excel_writer_xlsm IMPLEMENTATION.
* STEP 2: modify XML adding the vbaProject relation * STEP 2: modify XML adding the vbaProject relation
CREATE OBJECT lo_document_xml. CREATE OBJECT lo_document_xml.
lv_subrc = lo_document_xml->parse_xstring( ep_content ). lo_document_xml->parse_xstring( ep_content ).
lo_document ?= lo_document_xml->m_document. lo_document ?= lo_document_xml->m_document.
lo_element_root = lo_document->if_ixml_node~get_first_child( ). lo_element_root = lo_document->if_ixml_node~get_first_child( ).