Fix issue #326 - Leading Blanks are not shown

Fix issue #326 - Leading Blanks are not shown
Daily build needed from TIR
This commit is contained in:
Gh14Cc10 2014-10-15 12:16:03 +02:00
parent c31b7117c7
commit bed9584513
4 changed files with 27 additions and 14 deletions

View File

@ -2580,6 +2580,7 @@
lv_sytabix = sy-tabix - 1.
MOVE lv_sytabix TO ls_shared_string-string_no.
MOVE <fs_sheet_content>-cell_value TO ls_shared_string-string_value.
MOVE <fs_sheet_content>-data_type TO ls_shared_string-string_type.
APPEND ls_shared_string TO shared_strings.
ENDLOOP.
@ -2614,6 +2615,9 @@
parent = lo_document ).
lo_sub_element = lo_document->create_simple_element( name = lc_xml_node_t
parent = lo_document ).
if <fs_sheet_string>-string_type EQ 's_leading_blanks'.
lo_sub_element->set_attribute( name = 'space' namespace = 'xml' value = 'preserve' ).
endif.
lo_sub_element->set_value( value = <fs_sheet_string>-string_value ).
lo_element->append_child( new_child = lo_sub_element ).
lo_element_root->append_child( new_child = lo_element ).
@ -3489,15 +3493,20 @@
lo_element_3->append_child( new_child = lo_element_4 ). " fomula node
ELSEIF <ls_sheet_content>-cell_value IS NOT INITIAL. "cell can have just style or formula
IF <ls_sheet_content>-data_type IS NOT INITIAL.
lo_element_3->set_attribute_ns( name = lc_xml_attr_t
IF <ls_sheet_content>-data_type EQ 's_leading_blanks'.
lo_element_3->set_attribute_ns( name = lc_xml_attr_t
value = 's' ).
ELSE.
lo_element_3->set_attribute_ns( name = lc_xml_attr_t
value = <ls_sheet_content>-data_type ).
ENDIF.
ENDIF.
" value node
lo_element_4 = lo_document->create_simple_element( name = lc_xml_node_v
parent = lo_document ).
IF <ls_sheet_content>-data_type EQ 's'.
IF <ls_sheet_content>-data_type EQ 's' or <ls_sheet_content>-data_type EQ 's_leading_blanks'.
lv_value = me->get_shared_string_index( <ls_sheet_content>-cell_value ).
CONDENSE lv_value.
lo_element_4->set_value( value = lv_value ).

View File

@ -69,7 +69,7 @@ START-OF-SELECTION.
SUBMIT zdemo_excel27 WITH p_path = p_path AND RETURN. " abap2xlsx Demo: Conditional Formatting
SUBMIT zdemo_excel28 WITH p_path = p_path AND RETURN. " abap2xlsx Demo: CSV writer
" SUBMIT zdemo_excel29 WITH p_path = p_path AND RETURN. " abap2xlsx Demo: Macro enabled workbook
SUBMIT zdemo_excel30 WITH p_path = p_path AND RETURN. " abap2xlsx Demo: ABAP Cell data types
SUBMIT zdemo_excel30 WITH p_path = p_path AND RETURN. " abap2xlsx Demo: ABAP Cell data types + leading blanks string
SUBMIT zdemo_excel31 WITH p_path = p_path AND RETURN. " abap2xlsx Demo: Autosize Column with different Font sizes
" zdemo_excel32 is not added because it uses ALV and cannot be processed (Native)
SUBMIT zdemo_excel33 WITH p_path = p_path AND RETURN. " abap2xlsx Demo: Table autofilter

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-2"?>
<PROG NAME="ZDEMO_EXCEL30" VARCL="X" SUBC="1" CNAM="BCUSER" CDAT="20110821" UNAM="K2_SCHMOECK" UDAT="20120324" VERN="000039" RSTAT="T" RMAND="001" RLOAD="E" FIXPT="X" SDATE="20120324" STIME="111822" IDATE="20120324" ITIME="111822" UCCHECK="X">
<?xml version="1.0" encoding="utf-8"?>
<PROG NAME="ZDEMO_EXCEL30" VARCL="X" SUBC="1" RSTAT="T" RMAND="001" RLOAD="E" FIXPT="X" UCCHECK="X">
<textPool>
<language SPRAS="E">
<textElement ID="R" ENTRY="abap2xlsx Demo: ABAP Cell data types" LENGTH="37 "/>
@ -29,7 +29,8 @@ DATA: lv_value TYPE string,
CONSTANTS: lc_typekind_string TYPE abap_typekind VALUE cl_abap_typedescr=&gt;typekind_string,
lc_typekind_packed TYPE abap_typekind VALUE cl_abap_typedescr=&gt;typekind_packed,
lc_typekind_num TYPE abap_typekind VALUE cl_abap_typedescr=&gt;typekind_num,
lc_typekind_date TYPE abap_typekind VALUE cl_abap_typedescr=&gt;typekind_date.
lc_typekind_date TYPE abap_typekind VALUE cl_abap_typedescr=&gt;typekind_date,
lc_typekind_s_ls TYPE string VALUE &apos;s_leading_blanks&apos;.
CONSTANTS: gc_save_file_name TYPE string VALUE &apos;30_CellDataTypes.xlsx&apos;.
INCLUDE zdemo_excel_outputopt_incl.
@ -49,11 +50,13 @@ START-OF-SELECTION.
ip_abap_type = lc_typekind_string ).
lo_worksheet-&gt;set_cell( ip_column = &apos;B&apos; ip_row = 1 ip_value = &apos;String&apos;
ip_abap_type = lc_typekind_string ).
lo_worksheet-&gt;set_cell( ip_column = &apos;B&apos; ip_row = 2 ip_value = &apos;Negative Value&apos;
lo_worksheet-&gt;set_cell( ip_column = &apos;B&apos; ip_row = 2 ip_value = &apos; String with leading spaces&apos;
ip_data_type = lc_typekind_s_ls ).
lo_worksheet-&gt;set_cell( ip_column = &apos;B&apos; ip_row = 3 ip_value = &apos; Negative Value&apos;
ip_abap_type = lc_typekind_string ).
lo_worksheet-&gt;set_cell( ip_column = &apos;C&apos; ip_row = 1 ip_value = &apos;Packed&apos;
ip_abap_type = lc_typekind_string ).
lo_worksheet-&gt;set_cell( ip_column = &apos;C&apos; ip_row = 2 ip_value = &apos;50000.00-&apos;
lo_worksheet-&gt;set_cell( ip_column = &apos;C&apos; ip_row = 2 ip_value = &apos;50000.01-&apos;
ip_abap_type = lc_typekind_packed ).
lo_worksheet-&gt;set_cell( ip_column = &apos;D&apos; ip_row = 1 ip_value = &apos;Number with Percentage&apos;
ip_abap_type = lc_typekind_string ).
@ -65,7 +68,7 @@ START-OF-SELECTION.
ip_abap_type = lc_typekind_date ).
lo_worksheet-&gt;set_cell( ip_column = &apos;B&apos; ip_row = 3 ip_value = &apos;Positive Value&apos;
ip_abap_type = lc_typekind_string ).
lo_worksheet-&gt;set_cell( ip_column = &apos;C&apos; ip_row = 3 ip_value = &apos;5000.00&apos;
lo_worksheet-&gt;set_cell( ip_column = &apos;C&apos; ip_row = 3 ip_value = &apos;5000.02&apos;
ip_abap_type = lc_typekind_packed ).
lo_worksheet-&gt;set_cell( ip_column = &apos;D&apos; ip_row = 3 ip_value = &apos;50 %&apos;
ip_abap_type = lc_typekind_num ).

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-16"?>
<TABL TABNAME="ZEXCEL_S_SHARED_STRING" DDLANGUAGE="E" TABCLASS="INTTAB" DATMIN="0000000000" DATMAX="0000000000" DATAVG="0000000000" DDTEXT="Shared strings" AUTHCLASS="00" AS4USER="FEMIA" AS4DATE="20100713" AS4TIME="205442" PROZPUFF="000" EXCLASS="1">
<dd09l AS4VERS="0000" SCHFELDANZ="000" AS4DATE="00000000" AS4TIME="000000"/>
<dd03p TABNAME="ZEXCEL_S_SHARED_STRING" FIELDNAME="STRING_NO" DDLANGUAGE="E" POSITION="0001" ROLLNAME="INT4" ADMINFIELD="0" INTTYPE="X" INTLEN="000004" DOMNAME="INT4" ROUTPUTLEN="000000" HEADLEN="00" SCRLEN1="10" SCRLEN2="15" SCRLEN3="20" DTELMASTER="D" DATATYPE="INT4" LENG="000010" OUTPUTLEN="000010" DECIMALS="000000" SIGNFLAG="X" MASK=" INT4E" MASKLEN="0000" DDTEXT="Natural Number" SCRTEXT_S="Number" SCRTEXT_M="Number" SCRTEXT_L="Natural Number" DOMNAME3L="INT4" DEPTH="00" COMPTYPE="E" EXCLASS="0" DBPOSITION="0000"/>
<dd03p TABNAME="ZEXCEL_S_SHARED_STRING" FIELDNAME="STRING_VALUE" DDLANGUAGE="E" POSITION="0002" ROLLNAME="ZEXCEL_CELL_VALUE" ADMINFIELD="0" INTTYPE="g" INTLEN="000008" DOMNAME="STRING" ROUTPUTLEN="000000" HEADLEN="10" SCRLEN1="10" SCRLEN2="15" SCRLEN3="20" DTELMASTER="E" DATATYPE="STRG" LENG="000000" OUTPUTLEN="000000" DECIMALS="000000" MASK=" STRGE" MASKLEN="0000" DDTEXT="Cell Value" REPTEXT="Cell Value" SCRTEXT_S="Value" SCRTEXT_M="Cell Value" SCRTEXT_L="Cell Value" DOMNAME3L="STRING" DEPTH="00" COMPTYPE="E" EXCLASS="0" DBPOSITION="0000"/>
<?xml version="1.0" encoding="utf-8"?>
<TABL TABNAME="ZEXCEL_S_SHARED_STRING" DDLANGUAGE="E" TABCLASS="INTTAB" DATMIN="0000000000" DATMAX="0000000000" DATAVG="0000000000" DDTEXT="Shared strings" AUTHCLASS="00" PROZPUFF="000" EXCLASS="1">
<dd09l AS4VERS="0000" SCHFELDANZ="000"/>
<dd03p TABNAME="ZEXCEL_S_SHARED_STRING" FIELDNAME="STRING_NO" DDLANGUAGE="E" POSITION="0001" ROLLNAME="INT4" ADMINFIELD="0" INTTYPE="X" INTLEN="000004" DOMNAME="INT4" ROUTPUTLEN="000000" HEADLEN="00" SCRLEN1="10" SCRLEN2="15" SCRLEN3="20" DTELMASTER="D" DATATYPE="INT4" LENG="000010" OUTPUTLEN="000010" DECIMALS="000000" SIGNFLAG="X" MASK=" INT4E" MASKLEN="0000" DDTEXT="Natural Number" SCRTEXT_S="Number" SCRTEXT_M="Number" SCRTEXT_L="Natural Number" DOMNAME3L="INT4" DEPTH="00" COMPTYPE="E" EXCLASS="0" DBPOSITION="0000" OUTPUTSTYLE="00" STRORLOCPOS="00"/>
<dd03p TABNAME="ZEXCEL_S_SHARED_STRING" FIELDNAME="STRING_VALUE" DDLANGUAGE="E" POSITION="0002" ROLLNAME="ZEXCEL_CELL_VALUE" ADMINFIELD="0" INTTYPE="g" INTLEN="000008" DOMNAME="STRING" ROUTPUTLEN="000000" HEADLEN="10" SCRLEN1="10" SCRLEN2="15" SCRLEN3="20" DTELMASTER="E" DATATYPE="STRG" LENG="000000" OUTPUTLEN="000000" DECIMALS="000000" MASK=" STRGE" MASKLEN="0000" DDTEXT="Cell Value" REPTEXT="Cell Value" SCRTEXT_S="Value" SCRTEXT_M="Cell Value" SCRTEXT_L="Cell Value" DOMNAME3L="STRING" DEPTH="00" COMPTYPE="E" EXCLASS="0" DBPOSITION="0000" OUTPUTSTYLE="00" STRORLOCPOS="00"/>
<dd03p TABNAME="ZEXCEL_S_SHARED_STRING" FIELDNAME="STRING_TYPE" DDLANGUAGE="E" POSITION="0003" ROLLNAME="ZEXCEL_CELL_DATA_TYPE" ADMINFIELD="0" INTTYPE="g" INTLEN="000008" ROUTPUTLEN="000000" HEADLEN="14" SCRLEN1="09" SCRLEN2="14" SCRLEN3="14" DTELMASTER="E" DATATYPE="STRG" LENG="000000" OUTPUTLEN="000000" DECIMALS="000000" MASK=" STRGE" MASKLEN="0000" DDTEXT="Cell data type" REPTEXT="Cell data type" SCRTEXT_S="Data type" SCRTEXT_M="Cell data type" SCRTEXT_L="Cell data type" DEPTH="00" COMPTYPE="E" EXCLASS="0" DBPOSITION="0000" OUTPUTSTYLE="00" STRORLOCPOS="00"/>
</TABL>