Giter VIP home page Giter VIP logo

Comments (1)

sandraros avatar sandraros commented on June 16, 2024 1

Thanks for notifying about this issue, and for this very detailed analysis.

Reproduced. it works fine for oneCellAnchor which seems to always correspond to "move but don't size", but fails for 2 out of 3 cases with twoCellAnchor, it's always considered as "move and size". The attribute editAs is currently not considered by abap2xlsx.

I did the test on these four files with the demo program zdemo_excel37 which duplicates a file, I did the test with zcl_excel_reader_2007 and zcl_excel_writer_2007:

Concerned code:

  • drawing = me->get_ixml_from_zip_archive( ip_path ).
    * one-cell anchor **************
    anchors = drawing->get_elements_by_tag_name_ns( name = 'oneCellAnchor' uri = namespace-xdr ).
    coll_length = anchors->get_length( ).
    iterator = anchors->create_iterator( ).
    DO coll_length TIMES.
    anchor_elem ?= iterator->get_next( ).
    CALL METHOD me->load_drawing_anchor
    EXPORTING
    io_anchor_element = anchor_elem
    io_worksheet = io_worksheet
    it_related_drawings = rel_drawings.
    ENDDO.
    * two-cell anchor ******************
    anchors = drawing->get_elements_by_tag_name_ns( name = 'twoCellAnchor' uri = namespace-xdr ).
    coll_length = anchors->get_length( ).
    iterator = anchors->create_iterator( ).
    DO coll_length TIMES.
    anchor_elem ?= iterator->get_next( ).
    CALL METHOD me->load_drawing_anchor
    EXPORTING
    io_anchor_element = anchor_elem
    io_worksheet = io_worksheet
    it_related_drawings = rel_drawings.
    ENDDO.
  • ls_position = io_drawing->get_position( ).
    IF ls_position-anchor = 'ONE'.
    ep_anchor = io_document->create_simple_element( name = lc_xml_node_onecellanchor
    parent = io_document ).
    ELSE.
    ep_anchor = io_document->create_simple_element( name = lc_xml_node_twocellanchor
    parent = io_document ).
    ENDIF.
    * from cell ******************************
    lo_element_from = io_document->create_simple_element( name = lc_xml_node_from
    parent = io_document ).
    lv_col = ls_position-from-col.
    lv_row = ls_position-from-row.
    lv_col_offset = ls_position-from-col_offset.
    lv_row_offset = ls_position-from-row_offset.
    CONDENSE lv_col NO-GAPS.
    CONDENSE lv_row NO-GAPS.
    CONDENSE lv_col_offset NO-GAPS.
    CONDENSE lv_row_offset NO-GAPS.
    lo_element = io_document->create_simple_element( name = lc_xml_node_col
    parent = io_document ).
    lo_element->set_value( value = lv_col ).
    lo_element_from->append_child( new_child = lo_element ).
    lo_element = io_document->create_simple_element( name = lc_xml_node_coloff
    parent = io_document ).
    lo_element->set_value( value = lv_col_offset ).
    lo_element_from->append_child( new_child = lo_element ).
    lo_element = io_document->create_simple_element( name = lc_xml_node_row
    parent = io_document ).
    lo_element->set_value( value = lv_row ).
    lo_element_from->append_child( new_child = lo_element ).
    lo_element = io_document->create_simple_element( name = lc_xml_node_rowoff
    parent = io_document ).
    lo_element->set_value( value = lv_row_offset ).
    lo_element_from->append_child( new_child = lo_element ).
    ep_anchor->append_child( new_child = lo_element_from ).
    IF ls_position-anchor = 'ONE'.
    * ext ******************************
    lo_element_ext = io_document->create_simple_element( name = lc_xml_node_ext
    parent = io_document ).
    lv_value = io_drawing->get_width_emu_str( ).
    lo_element_ext->set_attribute_ns( name = 'cx'
    value = lv_value ).
    lv_value = io_drawing->get_height_emu_str( ).
    lo_element_ext->set_attribute_ns( name = 'cy'
    value = lv_value ).
    ep_anchor->append_child( new_child = lo_element_ext ).
    ELSEIF ls_position-anchor = 'TWO'.
    * to cell ******************************
    lo_element_to = io_document->create_simple_element( name = lc_xml_node_to
    parent = io_document ).
    lv_col = ls_position-to-col.
    lv_row = ls_position-to-row.
    lv_col_offset = ls_position-to-col_offset.
    lv_row_offset = ls_position-to-row_offset.
    CONDENSE lv_col NO-GAPS.
    CONDENSE lv_row NO-GAPS.
    CONDENSE lv_col_offset NO-GAPS.
    CONDENSE lv_row_offset NO-GAPS.
    lo_element = io_document->create_simple_element( name = lc_xml_node_col
    parent = io_document ).
    lo_element->set_value( value = lv_col ).
    lo_element_to->append_child( new_child = lo_element ).
    lo_element = io_document->create_simple_element( name = lc_xml_node_coloff
    parent = io_document ).
    lo_element->set_value( value = lv_col_offset ).
    lo_element_to->append_child( new_child = lo_element ).
    lo_element = io_document->create_simple_element( name = lc_xml_node_row
    parent = io_document ).
    lo_element->set_value( value = lv_row ).
    lo_element_to->append_child( new_child = lo_element ).
    lo_element = io_document->create_simple_element( name = lc_xml_node_rowoff
    parent = io_document ).
    lo_element->set_value( value = lv_row_offset ).
    lo_element_to->append_child( new_child = lo_element ).
    ep_anchor->append_child( new_child = lo_element_to ).
    ENDIF.

from abap2xlsx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.