mirror of
https://github.com/abap2xlsx/abap2xlsx.git
synced 2025-05-04 20:28:22 +08:00
Merge branch 'main' into sandraros/ixml-to-sxml
This commit is contained in:
commit
e58249ca6e
4
LICENSE
4
LICENSE
|
@ -1,4 +1,4 @@
|
|||
Apache License
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
|
@ -186,7 +186,7 @@ Apache License
|
|||
same "printed page" as the copyright notice for easier
|
||||
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");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
|
|
@ -9,6 +9,9 @@ CLASS zcl_excel_writer_csv DEFINITION
|
|||
|
||||
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
|
||||
IMPORTING
|
||||
VALUE(ip_value) TYPE c DEFAULT ';' .
|
||||
|
@ -24,7 +27,10 @@ CLASS zcl_excel_writer_csv DEFINITION
|
|||
CLASS-METHODS set_active_sheet_index_by_name
|
||||
IMPORTING
|
||||
!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!!!
|
||||
PROTECTED SECTION.
|
||||
*"* 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.
|
||||
CLASS-DATA worksheet_name TYPE zexcel_worksheets_name .
|
||||
CLASS-DATA worksheet_index TYPE zexcel_active_worksheet .
|
||||
CLASS-DATA initial_ext_date TYPE char10 VALUE c_default.
|
||||
|
||||
METHODS create
|
||||
RETURNING
|
||||
|
@ -53,7 +60,7 @@ ENDCLASS.
|
|||
|
||||
|
||||
|
||||
CLASS zcl_excel_writer_csv IMPLEMENTATION.
|
||||
CLASS ZCL_EXCEL_WRITER_CSV IMPLEMENTATION.
|
||||
|
||||
|
||||
METHOD create.
|
||||
|
@ -220,24 +227,28 @@ CLASS zcl_excel_writer_csv IMPLEMENTATION.
|
|||
CASE <fs_sheet_content>-data_type.
|
||||
|
||||
WHEN 'd' OR 'D'.
|
||||
lc_value = zcl_excel_common=>excel_string_to_date( ip_value = <fs_sheet_content>-cell_value ).
|
||||
TRY.
|
||||
lv_date = lc_value.
|
||||
CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'
|
||||
EXPORTING
|
||||
date_internal = lv_date
|
||||
IMPORTING
|
||||
date_external = lv_tmp
|
||||
EXCEPTIONS
|
||||
date_internal_is_invalid = 1
|
||||
OTHERS = 2.
|
||||
IF sy-subrc = 0.
|
||||
lc_value = lv_tmp.
|
||||
ENDIF.
|
||||
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 ).
|
||||
TRY.
|
||||
lv_date = lc_value.
|
||||
CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'
|
||||
EXPORTING
|
||||
date_internal = lv_date
|
||||
IMPORTING
|
||||
date_external = lv_tmp
|
||||
EXCEPTIONS
|
||||
date_internal_is_invalid = 1
|
||||
OTHERS = 2.
|
||||
IF sy-subrc = 0.
|
||||
lc_value = lv_tmp.
|
||||
ENDIF.
|
||||
|
||||
CATCH cx_sy_conversion_no_number.
|
||||
CATCH cx_sy_conversion_no_number.
|
||||
|
||||
ENDTRY.
|
||||
ENDTRY.
|
||||
ENDIF.
|
||||
|
||||
WHEN 't' OR 'T'.
|
||||
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.
|
||||
|
||||
|
||||
METHOD set_initial_ext_date.
|
||||
initial_ext_date = ip_value.
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD zif_excel_writer~write_file.
|
||||
me->excel = io_excel.
|
||||
ep_file = me->create( ).
|
||||
|
|
|
@ -32,6 +32,11 @@
|
|||
<LANGU>I</LANGU>
|
||||
<DESCRIPT>Create CSV ; Delimited format</DESCRIPT>
|
||||
</SEOCOMPOTX>
|
||||
<SEOCOMPOTX>
|
||||
<CMPNAME>C_DEFAULT</CMPNAME>
|
||||
<LANGU>E</LANGU>
|
||||
<DESCRIPT>Constant for string 'DEFAULT'</DESCRIPT>
|
||||
</SEOCOMPOTX>
|
||||
<SEOCOMPOTX>
|
||||
<CMPNAME>DELIMITER</CMPNAME>
|
||||
<LANGU>E</LANGU>
|
||||
|
@ -72,6 +77,11 @@
|
|||
<LANGU>I</LANGU>
|
||||
<DESCRIPT>Excel creator</DESCRIPT>
|
||||
</SEOCOMPOTX>
|
||||
<SEOCOMPOTX>
|
||||
<CMPNAME>INITIAL_EXT_DATE</CMPNAME>
|
||||
<LANGU>E</LANGU>
|
||||
<DESCRIPT>Initial External Date</DESCRIPT>
|
||||
</SEOCOMPOTX>
|
||||
<SEOCOMPOTX>
|
||||
<CMPNAME>SET_ACTIVE_SHEET_INDEX</CMPNAME>
|
||||
<LANGU>E</LANGU>
|
||||
|
@ -122,6 +132,11 @@
|
|||
<LANGU>I</LANGU>
|
||||
<DESCRIPT>Set End Of Line character</DESCRIPT>
|
||||
</SEOCOMPOTX>
|
||||
<SEOCOMPOTX>
|
||||
<CMPNAME>SET_INITIAL_EXT_DATE</CMPNAME>
|
||||
<LANGU>E</LANGU>
|
||||
<DESCRIPT>Set Initial External Date (replacing default '00.00.0000')</DESCRIPT>
|
||||
</SEOCOMPOTX>
|
||||
<SEOCOMPOTX>
|
||||
<CMPNAME>WORKSHEET_INDEX</CMPNAME>
|
||||
<LANGU>E</LANGU>
|
||||
|
@ -143,6 +158,14 @@
|
|||
<DESCRIPT>Worksheets name</DESCRIPT>
|
||||
</SEOCOMPOTX>
|
||||
</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:abap>
|
||||
</abapGit>
|
||||
|
|
Loading…
Reference in New Issue
Block a user