mirror of
https://github.com/abap2xlsx/abap2xlsx.git
synced 2025-05-05 14:16:30 +08:00
backwards compatibility
This commit is contained in:
parent
27b3467a8e
commit
23858bdf03
|
@ -184,8 +184,8 @@ class lcl_test implementation.
|
||||||
append `` to out->shared_strings.
|
append `` to out->shared_strings.
|
||||||
append `t` to out->shared_strings.
|
append `t` to out->shared_strings.
|
||||||
lo_reader = get_reader(
|
lo_reader = get_reader(
|
||||||
`<c r="A1" t="s"><v>0</v></c>` &&
|
`<c r="A1" t="s"><v>0</v></c>` &
|
||||||
`<c r="A2" t="inlineStr"><is><t></t></is></c>` &&
|
`<c r="A2" t="inlineStr"><is><t></t></is></c>` &
|
||||||
`<c r="A3" t="s"><v>1</v></c>`
|
`<c r="A3" t="s"><v>1</v></c>`
|
||||||
).
|
).
|
||||||
|
|
||||||
|
@ -239,12 +239,16 @@ class lcl_test implementation.
|
||||||
|
|
||||||
*
|
*
|
||||||
method test_read_shared_strings.
|
method test_read_shared_strings.
|
||||||
data: lo_reader type ref to if_sxml_reader,
|
data: lo_c2x type ref to cl_abap_conv_out_ce,
|
||||||
|
lv_xstring type xstring,
|
||||||
|
lo_reader type ref to if_sxml_reader,
|
||||||
lt_act type stringtab,
|
lt_act type stringtab,
|
||||||
lt_exp type stringtab.
|
lt_exp type stringtab.
|
||||||
lo_reader = cl_sxml_string_reader=>create( cl_abap_codepage=>convert_to(
|
|
||||||
`<sst><si><t/></si><si><t>Alpha</t></si><si><t>Bravo</t></si></sst>`
|
lo_c2x = cl_abap_conv_out_ce=>create( ).
|
||||||
) ).
|
lo_c2x->convert( exporting data = `<sst><si><t/></si><si><t>Alpha</t></si><si><t>Bravo</t></si></sst>`
|
||||||
|
importing buffer = lv_xstring ).
|
||||||
|
lo_reader = cl_sxml_string_reader=>create( lv_xstring ).
|
||||||
append :
|
append :
|
||||||
`` to lt_exp,
|
`` to lt_exp,
|
||||||
`Alpha` to lt_exp,
|
`Alpha` to lt_exp,
|
||||||
|
@ -259,13 +263,16 @@ class lcl_test implementation.
|
||||||
|
|
||||||
*
|
*
|
||||||
method test_skip_to_inexistent.
|
method test_skip_to_inexistent.
|
||||||
data: lo_reader type ref to if_sxml_reader,
|
data: lo_c2x type ref to cl_abap_conv_out_ce,
|
||||||
|
lv_xstring type xstring,
|
||||||
|
lo_reader type ref to if_sxml_reader,
|
||||||
lo_ex type ref to lcx_not_found,
|
lo_ex type ref to lcx_not_found,
|
||||||
lv_text type string.
|
lv_text type string.
|
||||||
|
|
||||||
lo_reader = cl_sxml_string_reader=>create( cl_abap_codepage=>convert_to(
|
lo_c2x = cl_abap_conv_out_ce=>create( ).
|
||||||
`<sst><si><t/></si><si><t>Alpha</t></si><si><t>Bravo</t></si></sst>`
|
lo_c2x->convert( exporting data = `<sst><si><t/></si><si><t>Alpha</t></si><si><t>Bravo</t></si></sst>`
|
||||||
) ).
|
importing buffer = lv_xstring ).
|
||||||
|
lo_reader = cl_sxml_string_reader=>create( lv_xstring ).
|
||||||
try.
|
try.
|
||||||
out->skip_to( iv_element_name = `nonExistingElement` io_reader = lo_reader ).
|
out->skip_to( iv_element_name = `nonExistingElement` io_reader = lo_reader ).
|
||||||
fail(`Skipping to non-existing element must raise lcx_not_found exception`).
|
fail(`Skipping to non-existing element must raise lcx_not_found exception`).
|
||||||
|
@ -276,9 +283,14 @@ class lcl_test implementation.
|
||||||
|
|
||||||
*
|
*
|
||||||
method get_reader.
|
method get_reader.
|
||||||
data: lv_full type string.
|
data: lv_full type string,
|
||||||
|
lo_c2x type ref to cl_abap_conv_out_ce,
|
||||||
|
lv_xstring type xstring.
|
||||||
concatenate `<root><sheetData><row>` iv_xml `</row></sheetData></root>` into lv_full.
|
concatenate `<root><sheetData><row>` iv_xml `</row></sheetData></root>` into lv_full.
|
||||||
eo_reader = cl_sxml_string_reader=>create( cl_abap_codepage=>convert_to( lv_full ) ).
|
lo_c2x = cl_abap_conv_out_ce=>create( ).
|
||||||
|
lo_c2x->convert( exporting data = lv_full
|
||||||
|
importing buffer = lv_xstring ).
|
||||||
|
eo_reader = cl_sxml_string_reader=>create( lv_xstring ).
|
||||||
endmethod. "get_reader
|
endmethod. "get_reader
|
||||||
*
|
*
|
||||||
method assert_value_equals.
|
method assert_value_equals.
|
||||||
|
@ -411,13 +423,15 @@ endmethod.</source>
|
||||||
<parameter CLSNAME="ZCL_EXCEL_READER_HUGE_FILE" CMPNAME="GET_SHARED_STRING" SCONAME="EV_VALUE" VERSION="1" LANGU="D" CMPTYPE="1" MTDTYPE="0" EDITORDER="2 " DISPID="0 " PARDECLTYP="3" PARPASSTYP="0" TYPTYPE="1" TYPE="STRING"/>
|
<parameter CLSNAME="ZCL_EXCEL_READER_HUGE_FILE" CMPNAME="GET_SHARED_STRING" SCONAME="EV_VALUE" VERSION="1" LANGU="D" CMPTYPE="1" MTDTYPE="0" EDITORDER="2 " DISPID="0 " PARDECLTYP="3" PARPASSTYP="0" TYPTYPE="1" TYPE="STRING"/>
|
||||||
<exception CLSNAME="ZCL_EXCEL_READER_HUGE_FILE" CMPNAME="GET_SHARED_STRING" SCONAME="LCX_NOT_FOUND" VERSION="1" LANGU="D" MTDTYPE="0" EDITORDER="1 "/>
|
<exception CLSNAME="ZCL_EXCEL_READER_HUGE_FILE" CMPNAME="GET_SHARED_STRING" SCONAME="LCX_NOT_FOUND" VERSION="1" LANGU="D" MTDTYPE="0" EDITORDER="1 "/>
|
||||||
<source>method GET_SHARED_STRING.
|
<source>method GET_SHARED_STRING.
|
||||||
data: lv_tabix type i.
|
data: lv_tabix type i,
|
||||||
|
lv_error type string.
|
||||||
lv_tabix = iv_index + 1.
|
lv_tabix = iv_index + 1.
|
||||||
read table shared_strings into ev_value index lv_tabix.
|
read table shared_strings into ev_value index lv_tabix.
|
||||||
if sy-subrc ne 0.
|
if sy-subrc ne 0.
|
||||||
|
concatenate 'Entry ' iv_index ' not found in Shared String Table' into lv_error.
|
||||||
raise exception type lcx_not_found
|
raise exception type lcx_not_found
|
||||||
exporting
|
exporting
|
||||||
error = |Entry { iv_index } not found in Shared String Table|.
|
error = lv_error.
|
||||||
endif.
|
endif.
|
||||||
endmethod.</source>
|
endmethod.</source>
|
||||||
</method>
|
</method>
|
||||||
|
@ -428,15 +442,17 @@ endmethod.</source>
|
||||||
<source>method GET_STYLE.
|
<source>method GET_STYLE.
|
||||||
|
|
||||||
data: lv_tabix type i,
|
data: lv_tabix type i,
|
||||||
lo_style type ref to zcl_excel_style.
|
lo_style type ref to zcl_excel_style,
|
||||||
|
lv_error type string.
|
||||||
|
|
||||||
if gs_buffer_style-index ne iv_index.
|
if gs_buffer_style-index ne iv_index.
|
||||||
lv_tabix = iv_index + 1.
|
lv_tabix = iv_index + 1.
|
||||||
read table styles into lo_style index lv_tabix.
|
read table styles into lo_style index lv_tabix.
|
||||||
if sy-subrc ne 0.
|
if sy-subrc ne 0.
|
||||||
|
concatenate 'Entry ' iv_index ' not found in Style Table' into lv_error.
|
||||||
raise exception type lcx_not_found
|
raise exception type lcx_not_found
|
||||||
exporting
|
exporting
|
||||||
error = |Entry { iv_index } not found in Style Table|.
|
error = lv_error.
|
||||||
else.
|
else.
|
||||||
gs_buffer_style-index = iv_index.
|
gs_buffer_style-index = iv_index.
|
||||||
gs_buffer_style-guid = lo_style->get_guid( ).
|
gs_buffer_style-guid = lo_style->get_guid( ).
|
||||||
|
@ -565,18 +581,21 @@ endmethod.</source>
|
||||||
<exception CLSNAME="ZCL_EXCEL_READER_HUGE_FILE" CMPNAME="SKIP_TO" SCONAME="LCX_NOT_FOUND" VERSION="1" LANGU="D" MTDTYPE="0" EDITORDER="1 "/>
|
<exception CLSNAME="ZCL_EXCEL_READER_HUGE_FILE" CMPNAME="SKIP_TO" SCONAME="LCX_NOT_FOUND" VERSION="1" LANGU="D" MTDTYPE="0" EDITORDER="1 "/>
|
||||||
<source>method SKIP_TO.
|
<source>method SKIP_TO.
|
||||||
|
|
||||||
|
data: lv_error type string.
|
||||||
|
|
||||||
* Skip forward to given element
|
* Skip forward to given element
|
||||||
while io_reader->name ne iv_element_name or
|
while io_reader->name ne iv_element_name or
|
||||||
io_reader->node_type ne c_element_open.
|
io_reader->node_type ne c_element_open.
|
||||||
io_reader->next_node( ).
|
io_reader->next_node( ).
|
||||||
if io_reader->node_type = c_end_of_stream.
|
if io_reader->node_type = c_end_of_stream.
|
||||||
|
concatenate 'XML error: Didn''t find element <' iv_element_name '>' into lv_error.
|
||||||
raise exception type lcx_not_found
|
raise exception type lcx_not_found
|
||||||
exporting
|
exporting
|
||||||
error = |XML error: Didn't find element <{ iv_element_name }>|.
|
error = lv_error.
|
||||||
endif.
|
endif.
|
||||||
endwhile.
|
endwhile.
|
||||||
|
|
||||||
|
|
||||||
endmethod.</source>
|
endmethod.</source>
|
||||||
</method>
|
</method>
|
||||||
</CLAS>
|
</CLAS>
|
Loading…
Reference in New Issue
Block a user