diff --git a/ZA2X/CLAS/ZCL_EXCEL_READER_2007.slnk b/ZA2X/CLAS/ZCL_EXCEL_READER_2007.slnk index e30e08f..83b5c69 100644 --- a/ZA2X/CLAS/ZCL_EXCEL_READER_2007.slnk +++ b/ZA2X/CLAS/ZCL_EXCEL_READER_2007.slnk @@ -113,7 +113,7 @@ method ZIF_EXCEL_READER~CAN_READ_FILE. *--------------------------------------------------------------------* * issue #230 - Pimp my Code -* - Stefan Schmöcker, (done) 2012-11-07 +* - Stefan Schmöcker, (done) 2012-11-07 * - ... * changes: nothing done in code * but started discussion about killing this method @@ -126,12 +126,12 @@ method ZIF_EXCEL_READER~LOAD. *--------------------------------------------------------------------* * ToDos: -* 2do§1 Map Document Properties to ZCL_EXCEL +* 2do§1 Map Document Properties to ZCL_EXCEL *--------------------------------------------------------------------* *--------------------------------------------------------------------* * issue #230 - Pimp my Code -* - Stefan Schmöcker, (done) 2012-11-07 +* - Stefan Schmöcker, (done) 2012-11-07 * - ... * changes: renaming variables to naming conventions * removing unused variables @@ -141,7 +141,7 @@ * adding me-> where possible *--------------------------------------------------------------------* * issue#234 - error reading xlsx written by libre office -* - Stefan Schmöcker, 2012-11-07 +* - Stefan Schmöcker, 2012-11-07 * changes: passing new optional input parameter to private attribute *--------------------------------------------------------------------* @@ -153,9 +153,9 @@ ls_relationship TYPE t_relationship. *--------------------------------------------------------------------* -* §1 Create EXCEL-Object we want to return to caller +* §1 Create EXCEL-Object we want to return to caller -* §2 We need to read the the file "\\_rels\.rels" because it tells +* §2 We need to read the the file "\\_rels\.rels" because it tells * us where in this folder structure the data for the workbook * is located in the xlsx zip-archive * @@ -168,7 +168,7 @@ * |--> theme * |--> worksheets -* §3 Extracting from this the path&file where the workbook is located +* §3 Extracting from this the path&file where the workbook is located * Following is an example how this file could be set up * <?xml version="1.0" encoding="UTF-8" standalone="true"?> * <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"> @@ -180,7 +180,7 @@ *--------------------------------------------------------------------* -* §1 Create EXCEL-Object we want to return to caller +* §1 Create EXCEL-Object we want to return to caller *--------------------------------------------------------------------* CREATE OBJECT r_excel. @@ -191,13 +191,13 @@ *--------------------------------------------------------------------* -* §2 Get file in folderstructure +* §2 Get file in folderstructure *--------------------------------------------------------------------* me->excel2007 = i_excel2007. lo_rels = me->get_ixml_from_zip_archive( '_rels/.rels' ). *--------------------------------------------------------------------* -* §3 Cycle through the Relationship Tags and use the ones we need +* §3 Cycle through the Relationship Tags and use the ones we need *--------------------------------------------------------------------* lo_node ?= lo_rels->find_from_name( 'Relationship' ). "#EC NOTEXT WHILE lo_node IS BOUND. @@ -209,7 +209,7 @@ CASE ls_relationship-type. WHEN lcv_core_properties. - " 2do§1 Map Document Properties to ZCL_EXCEL + " 2do§1 Map Document Properties to ZCL_EXCEL WHEN lcv_office_document. me->load_workbook( iv_workbook_full_filename = ls_relationship-target @@ -229,16 +229,16 @@ METHOD zif_excel_reader~load_file. *--------------------------------------------------------------------* * ToDos: -* 2do§1 decision whether to load from frontend or backend +* 2do§1 decision whether to load from frontend or backend * current behavior ( autodecide ) should be default * add optional parameter to allow user to choose * to load from backend even when online -* 2do§2 loosen typing of i_filename to CLIKE +* 2do§2 loosen typing of i_filename to CLIKE *--------------------------------------------------------------------* *--------------------------------------------------------------------* * issue #230 - Pimp my Code -* - Stefan Schmöcker, (done) 2012-11-05 +* - Stefan Schmöcker, (done) 2012-11-05 * - ... * changes: renaming variables to naming conventions * renaming variables to indicate what they are used for @@ -251,7 +251,7 @@ * added errorhandling for open dataset *--------------------------------------------------------------------* * issue#234 - error reading xlsx written by libre office -* - Stefan Schmöcker, 2012-11-07 +* - Stefan Schmöcker, 2012-11-07 * changes: passing new optional input parameter to private attribute *--------------------------------------------------------------------* @@ -280,7 +280,7 @@ method FILL_STRUCT_FROM_ATTRIBUTES. *--------------------------------------------------------------------* * issue #230 - Pimp my Code -* - Stefan Schmöcker, (done) 2012-11-07 +* - Stefan Schmöcker, (done) 2012-11-07 * - ... * changes: renaming variables to naming conventions * aligning code @@ -332,7 +332,7 @@ method GET_FROM_ZIP_ARCHIVE. *--------------------------------------------------------------------* * issue #230 - Pimp my Code -* - Stefan Schmöcker, (done) 2012-11-07 +* - Stefan Schmöcker, (done) 2012-11-07 * - ... * changes: aligning code * adding comments to explain what we are trying to achieve @@ -340,7 +340,7 @@ * message made to support multilinguality *--------------------------------------------------------------------**--------------------------------------------------------------------* * issue#234 - error reading xlsx written by libre office -* - Stefan Schmöcker, 2012-11-07 +* - Stefan Schmöcker, 2012-11-07 * changes: copying coding and using ALTERNATE_ZIP in ELSE-Branch *--------------------------------------------------------------------* @@ -459,12 +459,12 @@ method GET_IXML_FROM_ZIP_ARCHIVE. *--------------------------------------------------------------------* * ToDos: -* 2do§1 Add comment what is being achieved here +* 2do§1 Add comment what is being achieved here *--------------------------------------------------------------------* *--------------------------------------------------------------------* * issue #230 - Pimp my Code -* - Stefan Schmöcker, (done) 2012-11-07 +* - Stefan Schmöcker, (done) 2012-11-07 * - ... * changes: renaming variables to naming conventions * removing unnecessary type-pool @@ -480,7 +480,7 @@ *--------------------------------------------------------------------* -* 2do§1 ???? Something happens here ??? +* 2do§1 ???? Something happens here ??? *--------------------------------------------------------------------* lv_content = me->get_from_zip_archive( i_filename ). lo_ixml = cl_ixml=>create( ). @@ -655,12 +655,12 @@ method LOAD_SHARED_STRINGS. *--------------------------------------------------------------------* * ToDos: -* 2do§1 Support partial formatting of strings in cells +* 2do§1 Support partial formatting of strings in cells *--------------------------------------------------------------------* *--------------------------------------------------------------------* * issue #230 - Pimp my Code -* - Stefan Schmöcker, (done) 2012-11-11 +* - Stefan Schmöcker, (done) 2012-11-11 * - ... * changes: renaming variables to naming conventions * renaming variables to indicate what they are used for @@ -683,10 +683,10 @@ *--------------------------------------------------------------------* -* §1 Parse shared strings file and get into internal table +* §1 Parse shared strings file and get into internal table * So far I have encountered 2 ways how a string can be represented in the shared strings file -* §1.1 - "simple" strings -* §1.2 - rich text formatted strings +* §1.1 - "simple" strings +* §1.2 - rich text formatted strings * Following is an example how this file could be set up; 2 strings in simple formatting, 3rd string rich textformatted @@ -738,15 +738,15 @@ lv_tag_name = lo_node_si_child->get_name( ). IF lv_tag_name = 't'. *--------------------------------------------------------------------* -* §1.1 - "simple" strings +* §1.1 - "simple" strings * Example: see above *--------------------------------------------------------------------* <lv_shared_string> = lo_node_si_child->get_value( ). ELSE. *--------------------------------------------------------------------* -* §1.2 - rich text formatted strings +* §1.2 - rich text formatted strings * it is sufficient to strip the <t>...</t> tag from each <r>-tag and concatenate these -* as long as rich text formatting is not supported (2do§1) ignore all info about formatting +* as long as rich text formatting is not supported (2do§1) ignore all info about formatting * Example: see above *--------------------------------------------------------------------* WHILE lo_node_si_child IS BOUND. " actually these children of <si> are <r>-tags @@ -776,7 +776,7 @@ *--------------------------------------------------------------------* * issue #230 - Pimp my Code -* - Stefan Schmöcker, (wip ) 2012-11-25 +* - Stefan Schmöcker, (wip ) 2012-11-25 * - ... * changes: renaming variables and types to naming conventions * aligning code @@ -844,16 +844,16 @@ *--------------------------------------------------------------------* * To build a complete style that fully describes how a cell looks like * we need the various parts -* §1 - Numberformat -* §2 - Fillstyle -* §3 - Borders -* §4 - Font -* §5 - Alignment -* §6 - Protection +* §1 - Numberformat +* §2 - Fillstyle +* §3 - Borders +* §4 - Font +* §5 - Alignment +* §6 - Protection * Following is an example how this part of a file could be set up * ... -* parts with various formatinformation - see §1,§2,§3,§4 +* parts with various formatinformation - see §1,§2,§3,§4 * ... * <cellXfs count="26"> * <xf numFmtId="0" borderId="0" fillId="0" fontId="0" xfId="0"/> @@ -871,17 +871,17 @@ *--------------------------------------------------------------------* * The styles are build up from -* §1 number formats -* §2 fill styles -* §3 border styles -* §4 fonts +* §1 number formats +* §2 fill styles +* §3 border styles +* §4 fonts * These need to be read before we can try to build up a complete * style that describes the look of a cell *--------------------------------------------------------------------* - lt_num_formats = load_style_num_formats( lo_styles_xml ). " §1 - lt_fills = load_style_fills( lo_styles_xml ). " §2 - lt_borders = load_style_borders( lo_styles_xml ). " §3 - lt_fonts = load_style_fonts( lo_styles_xml ). " §4 + lt_num_formats = load_style_num_formats( lo_styles_xml ). " §1 + lt_fills = load_style_fills( lo_styles_xml ). " §2 + lt_borders = load_style_borders( lo_styles_xml ). " §3 + lt_fonts = load_style_fonts( lo_styles_xml ). " §4 *--------------------------------------------------------------------* * Now everything is prepared to build a "full" style @@ -899,7 +899,7 @@ CHANGING cp_structure = ls_xf ). *--------------------------------------------------------------------* -* §2 fill style +* §2 fill style *--------------------------------------------------------------------* IF ls_xf-applyfill = '1' AND ls_xf-fillid IS NOT INITIAL. lv_index = ls_xf-fillid + 1. @@ -910,7 +910,7 @@ ENDIF. *--------------------------------------------------------------------* -* §1 number format +* §1 number format *--------------------------------------------------------------------* IF ls_xf-numfmtid IS NOT INITIAL. READ TABLE lt_num_formats INTO ls_num_format WITH TABLE KEY id = ls_xf-numfmtid. @@ -920,7 +920,7 @@ ENDIF. *--------------------------------------------------------------------* -* §3 border style +* §3 border style *--------------------------------------------------------------------* IF ls_xf-applyborder = '1' AND ls_xf-borderid IS NOT INITIAL. lv_index = ls_xf-borderid + 1. @@ -931,7 +931,7 @@ ENDIF. *--------------------------------------------------------------------* -* §4 font +* §4 font *--------------------------------------------------------------------* IF ls_xf-applyfont = '1' AND ls_xf-fontid IS NOT INITIAL. lv_index = ls_xf-fontid + 1. @@ -942,7 +942,7 @@ ENDIF. *--------------------------------------------------------------------* -* §5 - Alignment +* §5 - Alignment *--------------------------------------------------------------------* lo_node_cellxfs_xf_alignment ?= lo_node_cellxfs_xf->find_from_name( 'alignment' ). IF lo_node_cellxfs_xf_alignment IS BOUND. @@ -976,7 +976,7 @@ ENDIF. *--------------------------------------------------------------------* -* §6 - Protection +* §6 - Protection *--------------------------------------------------------------------* lo_node_cellxfs_xf_protection ?= lo_node_cellxfs_xf->find_from_name( 'protection' ). IF lo_node_cellxfs_xf_protection IS BOUND. @@ -1014,7 +1014,7 @@ *--------------------------------------------------------------------* * issue #230 - Pimp my Code -* - Stefan Schmöcker, (done) 2012-11-25 +* - Stefan Schmöcker, (done) 2012-11-25 * - ... * changes: renaming variables and types to naming conventions * aligning code @@ -1030,11 +1030,11 @@ *--------------------------------------------------------------------* * We need a table of used borderformats to build up our styles -* §1 A cell has 4 outer borders and 2 diagonal "borders" +* §1 A cell has 4 outer borders and 2 diagonal "borders" * These borders can be formatted separately but the diagonal borders * are always being formatted the same * We'll parse through the <border>-tag for each of the bordertypes -* §2 and read the corresponding formatting information +* §2 and read the corresponding formatting information * Following is an example how this part of a file could be set up * <border diagonalDown="1"> @@ -1077,7 +1077,7 @@ lo_node_bordertype ?= lo_node_border->get_first_child( ). WHILE lo_node_bordertype IS BOUND. *--------------------------------------------------------------------* -* §1 Determine what kind of border we are talking about +* §1 Determine what kind of border we are talking about *--------------------------------------------------------------------* * Up, down, left, right, diagonal *--------------------------------------------------------------------* @@ -1103,7 +1103,7 @@ ENDCASE. *--------------------------------------------------------------------* -* §2 Read the border-formatting +* §2 Read the border-formatting *--------------------------------------------------------------------* lo_border->border_style = lo_node_bordertype->get_attribute( 'style' ). lo_node_bordercolor ?= lo_node_bordertype->find_from_name( 'color' ). @@ -1143,12 +1143,12 @@ method LOAD_STYLE_FILLS. *--------------------------------------------------------------------* * ToDos: -* 2do§1 Support gradientFill +* 2do§1 Support gradientFill *--------------------------------------------------------------------* *--------------------------------------------------------------------* * issue #230 - Pimp my Code -* - Stefan Schmöcker, (done) 2012-11-25 +* - Stefan Schmöcker, (done) 2012-11-25 * - ... * changes: renaming variables and types to naming conventions * aligning code @@ -1239,7 +1239,7 @@ * gradientFill *--------------------------------------------------------------------* WHEN 'gradientFill'. - " 2do§1 Support gradientFill + " 2do§1 Support gradientFill WHEN OTHERS. @@ -1262,7 +1262,7 @@ *--------------------------------------------------------------------* * issue #230 - Pimp my Code -* - Stefan Schmöcker, (done) 2012-11-25 +* - Stefan Schmöcker, (done) 2012-11-25 * - ... * changes: renaming variables and types to naming conventions * aligning code @@ -1387,12 +1387,12 @@ method LOAD_STYLE_NUM_FORMATS. *--------------------------------------------------------------------* * ToDos: -* 2do§1 Explain gaps in predefined formats +* 2do§1 Explain gaps in predefined formats *--------------------------------------------------------------------* *--------------------------------------------------------------------* * issue #230 - Pimp my Code -* - Stefan Schmöcker, (done) 2012-11-25 +* - Stefan Schmöcker, (done) 2012-11-25 * - ... * changes: renaming variables and types to naming conventions * adding comments to explain what we are trying to achieve @@ -1404,12 +1404,12 @@ *--------------------------------------------------------------------* * We need a table of used numberformats to build up our styles * there are two kinds of numberformats -* §1 those that have been explicitly added by the createor of the excel-file -* §2 and built-in numberformats +* §1 those that have been explicitly added by the createor of the excel-file +* §2 and built-in numberformats *--------------------------------------------------------------------* *--------------------------------------------------------------------* -* §1 Get non-internal numberformats that are found in the file explicitly +* §1 Get non-internal numberformats that are found in the file explicitly * Following is an example how this part of a file could be set up * <numFmts count="1"> @@ -1438,7 +1438,7 @@ END-OF-DEFINITION. *--------------------------------------------------------------------* -* §1 Get internal predefined numberformats +* §1 Get internal predefined numberformats *--------------------------------------------------------------------* predefined_format '1' '0'. predefined_format '2' '0.00'. @@ -1462,7 +1462,7 @@ predefined_format '20' 'h:mm'. predefined_format '21' 'h:mm:ss'. predefined_format '22' 'm/d/yyyy h:mm'. -* 2do§1 Why is there a gap in here? +* 2do§1 Why is there a gap in here? @@ -1480,7 +1480,7 @@ predefined_format '38' '#,##0_);[Red](#,##0)'. predefined_format '39' '#,##0.00_);(#,##0.00)'. predefined_format '40' '#,##0.00_);[Red](#,##0.00)'. -* 2do§1 Why is there a gap in here? +* 2do§1 Why is there a gap in here? @@ -1489,7 +1489,7 @@ predefined_format '47' 'mm:ss.0'. predefined_format '48' '##0.0E+0'. predefined_format '49' '@'. -* 2do§1 Is 49 really the last predefined format? +* 2do§1 Is 49 really the last predefined format? endmethod. @@ -1501,14 +1501,14 @@ method LOAD_WORKBOOK. *--------------------------------------------------------------------* * ToDos: -* 2do§1 Move macro-reading from zcl_excel_reader_xlsm to this class +* 2do§1 Move macro-reading from zcl_excel_reader_xlsm to this class * autodetect existance of macro/vba content * Allow inputparameter to explicitly tell reader to ignore vba-content *--------------------------------------------------------------------* *--------------------------------------------------------------------* * issue #230 - Pimp my Code -* - Stefan Schmöcker, (done) 2012-11-10 +* - Stefan Schmöcker, (done) 2012-11-10 * - ... * changes: renaming variables to naming conventions * aligning code @@ -1520,15 +1520,15 @@ * ip_excel renamed while being at it --> rename to io_excel *--------------------------------------------------------------------* * issue #232 - Read worksheetstate hidden/veryHidden -* - Stefan Schmöcker, 2012-11-11 +* - Stefan Schmöcker, 2012-11-11 *--------------------------------------------------------------------* * issue#235 - repeat rows/columns -* - Stefan Schmöcker, 2012-12-02 +* - Stefan Schmöcker, 2012-12-02 * changes: correction in named ranges to correctly attach * sheetlocal names/ranges to the correct sheet *--------------------------------------------------------------------* * issue#284 - Copied formulae ignored when reading excelfile -* - Stefan Schmöcker, 2013-08-02 +* - Stefan Schmöcker, 2013-08-02 * changes: initialize area to hold referenced formulaedata * after all worksheets have been read resolve formuae *--------------------------------------------------------------------* @@ -1591,7 +1591,7 @@ *--------------------------------------------------------------------* -* §1 Get the position of files related to this workbook +* §1 Get the position of files related to this workbook * Usually this will be <root>/xl/workbook.xml * Thus the workbookroot will be <root>/xl/ * The position of all related files will be given in file @@ -1611,19 +1611,19 @@ * <Relationship Target="sharedStrings.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings" Id="rId7"/> * </Relationships> * -* §2 Load data that is relevant to the complete workbook +* §2 Load data that is relevant to the complete workbook * Currently supported is: -* §2.1 Shared strings - This holds all strings that are used in all worksheets -* §2.2 Styles - This holds all styles that are used in all worksheets -* §2.3 Worksheets - For each worksheet in the workbook one entry appears here to point to the file that holds the content of this worksheet -* §2.4 [Themes] - not supported -* §2.5 [VBA (Macro)] - supported in class zcl_excel_reader_xlsm but should be moved here and autodetect +* §2.1 Shared strings - This holds all strings that are used in all worksheets +* §2.2 Styles - This holds all styles that are used in all worksheets +* §2.3 Worksheets - For each worksheet in the workbook one entry appears here to point to the file that holds the content of this worksheet +* §2.4 [Themes] - not supported +* §2.5 [VBA (Macro)] - supported in class zcl_excel_reader_xlsm but should be moved here and autodetect * ... * -* §3 Some information is held in the workbookfile as well -* §3.1 Names and order of of worksheets -* §3.2 Active worksheet -* §3.3 Defined names +* §3 Some information is held in the workbookfile as well +* §3.1 Names and order of of worksheets +* §3.2 Active worksheet +* §3.3 Defined names * ... * Following is an example how this file could be set up @@ -1648,7 +1648,7 @@ CLEAR me->mt_ref_formulae. " ins issue#284 *--------------------------------------------------------------------* -* §1 Get the position of files related to this workbook +* §1 Get the position of files related to this workbook * Entry into this method is with the filename of the workbook *--------------------------------------------------------------------* CALL FUNCTION 'TRINT_SPLIT_FILE_AND_PATH' @@ -1670,7 +1670,7 @@ CASE ls_relationship-type. *--------------------------------------------------------------------* -* §2.1 Shared strings - This holds all strings that are used in all worksheets +* §2.1 Shared strings - This holds all strings that are used in all worksheets *--------------------------------------------------------------------* WHEN lcv_shared_strings. CONCATENATE lv_path ls_relationship-target @@ -1678,7 +1678,7 @@ me->load_shared_strings( lv_full_filename ). *--------------------------------------------------------------------* -* §2.3 Worksheets +* §2.3 Worksheets * For each worksheet in the workbook one entry appears here to point to the file that holds the content of this worksheet * Shared strings and styles have to be present before we can start with creating the worksheets * thus we only store this information for use when parsing the workbookfile for sheetinformations @@ -1687,7 +1687,7 @@ APPEND ls_relationship TO lt_worksheets. *--------------------------------------------------------------------* -* §2.2 Styles - This holds the styles that are used in all worksheets +* §2.2 Styles - This holds the styles that are used in all worksheets *--------------------------------------------------------------------* WHEN lcv_styles. CONCATENATE lv_path ls_relationship-target @@ -1704,12 +1704,12 @@ ENDWHILE. *--------------------------------------------------------------------* -* §3 Some information held in the workbookfile +* §3 Some information held in the workbookfile *--------------------------------------------------------------------* lo_workbook = me->get_ixml_from_zip_archive( iv_workbook_full_filename ). *--------------------------------------------------------------------* -* §3.1 Names and order of of worksheets +* §3.1 Names and order of of worksheets *--------------------------------------------------------------------* lo_node ?= lo_workbook->find_from_name( 'sheet' ). lv_workbook_index = 1. @@ -1772,7 +1772,7 @@ " ins issue#284 *--------------------------------------------------------------------* * #229: Set active worksheet - begin coding -* §3.2 Active worksheet +* §3.2 Active worksheet *--------------------------------------------------------------------* lv_zexcel_active_worksheet = 1. " First sheet = active sheet if nothing else specified. lo_node ?= lo_workbook->find_from_name( 'workbookView' ). @@ -1790,7 +1790,7 @@ *--------------------------------------------------------------------* -* §3.3 Defined names +* §3.3 Defined names * So far I have encountered these * - named ranges - sheetlocal * - named ranges - workbookglobal @@ -1920,7 +1920,7 @@ method LOAD_WORKSHEET. *--------------------------------------------------------------------* * ToDos: -* 2do§1 Header/footer +* 2do§1 Header/footer * * Please don't just delete these ToDos if they are not * needed but leave a comment that states this @@ -1928,7 +1928,7 @@ *--------------------------------------------------------------------* * issue #230 - Pimp my Code -* - Stefan Schmöcker, +* - Stefan Schmöcker, * - ... * changes: renaming variables to naming conventions * aligning code (started) @@ -2010,6 +2010,28 @@ theme TYPE string, END OF lty_tabcolor. + TYPES: BEGIN OF lty_datavalidation, + type TYPE zexcel_data_val_type, + allowblank TYPE flag, + showinputmessage TYPE flag, + showerrormessage TYPE flag, + showdropdown TYPE flag, + operator TYPE zexcel_data_val_operator, + formula1 TYPE zexcel_validation_formula1, + formula2 TYPE zexcel_validation_formula1, + sqref TYPE string, + cell_column TYPE zexcel_cell_column_alpha, + cell_column_to TYPE zexcel_cell_column_alpha, + cell_row TYPE zexcel_cell_row, + cell_row_to TYPE zexcel_cell_row, + error TYPE string, + errortitle TYPE string, + prompt TYPE string, + prompttitle TYPE string, + errorstyle TYPE zexcel_data_val_error_style, + END OF lty_datavalidation. + + CONSTANTS: lc_xml_attr_true TYPE string VALUE 'true', lc_xml_attr_true_int TYPE string VALUE '1', @@ -2095,11 +2117,17 @@ lo_ixml_rels_worksheet TYPE REF TO if_ixml_document, lv_rels_worksheet_path TYPE string, lv_stripped_name TYPE chkfile, - lv_dirname TYPE string. + lv_dirname TYPE string, + lo_ixml_datavalidations TYPE REF TO if_ixml_node_collection, + lo_ixml_datavalidation_elem TYPE REF TO if_ixml_element, + ls_datavalidation TYPE lty_datavalidation, + lo_data_validation TYPE REF TO zcl_excel_data_validation, + lv_datavalidation_range TYPE string, + lt_datavalidation_range TYPE TABLE OF string. *--------------------------------------------------------------------* -* §2 We need to read the the file "\\_rels\.rels" because it tells +* §2 We need to read the the file "\\_rels\.rels" because it tells * us where in this folder structure the data for the workbook * is located in the xlsx zip-archive * @@ -2498,7 +2526,7 @@ ls_odd_footer-left_value = lo_ixml_hf_value_elem->get_value( ). ENDIF. -* 2do§1 Header/footer +* 2do§1 Header/footer " TODO.. get the rest. io_worksheet->sheet_setup->set_header_footer( ip_odd_header = ls_odd_header @@ -2535,6 +2563,57 @@ ENDIF. " End fix 194 Read attributes HIDDEN, OUTLINELEVEL, COLLAPSED in ZCL_EXCEL_READER_2007 + " Start fix 276 Read data validations + lo_ixml_datavalidations = lo_ixml_worksheet->get_elements_by_tag_name( name = 'dataValidation' ). + lo_ixml_iterator = lo_ixml_datavalidations->create_iterator( ). + lo_ixml_datavalidation_elem ?= lo_ixml_iterator->get_next( ). + WHILE lo_ixml_datavalidation_elem IS BOUND. + fill_struct_from_attributes( EXPORTING + ip_element = lo_ixml_datavalidation_elem + CHANGING + cp_structure = ls_datavalidation ). + clear lo_ixml_formula_elem. + lo_ixml_formula_elem = lo_ixml_datavalidation_elem->find_from_name( name = 'formula1' ). + if lo_ixml_formula_elem is bound. + ls_datavalidation-formula1 = lo_ixml_formula_elem->get_value( ). + endif. + clear lo_ixml_formula_elem. + lo_ixml_formula_elem = lo_ixml_datavalidation_elem->find_from_name( name = 'formula2' ). + if lo_ixml_formula_elem is bound. + ls_datavalidation-formula2 = lo_ixml_formula_elem->get_value( ). + endif. + SPLIT ls_datavalidation-sqref AT space INTO TABLE lt_datavalidation_range. + LOOP AT lt_datavalidation_range INTO lv_datavalidation_range. + zcl_excel_common=>convert_range2column_a_row( EXPORTING + i_range = lv_datavalidation_range + IMPORTING + e_column_start = ls_datavalidation-cell_column + e_column_end = ls_datavalidation-cell_column_to + e_row_start = ls_datavalidation-cell_row + e_row_end = ls_datavalidation-cell_row_to ). + lo_data_validation = io_worksheet->add_new_data_validation( ). + lo_data_validation->type = ls_datavalidation-type. + lo_data_validation->allowblank = ls_datavalidation-allowblank. + lo_data_validation->showinputmessage = ls_datavalidation-showinputmessage. + lo_data_validation->showerrormessage = ls_datavalidation-showerrormessage. + lo_data_validation->showdropdown = ls_datavalidation-showdropdown. + lo_data_validation->operator = ls_datavalidation-operator. + lo_data_validation->formula1 = ls_datavalidation-formula1. + lo_data_validation->formula2 = ls_datavalidation-formula2. + lo_data_validation->prompttitle = ls_datavalidation-prompttitle. + lo_data_validation->prompt = ls_datavalidation-prompt. + lo_data_validation->errortitle = ls_datavalidation-errortitle. + lo_data_validation->error = ls_datavalidation-error. + lo_data_validation->errorstyle = ls_datavalidation-errorstyle. + lo_data_validation->cell_row = ls_datavalidation-cell_row. + lo_data_validation->cell_row_to = ls_datavalidation-cell_row_to. + lo_data_validation->cell_column = ls_datavalidation-cell_column. + lo_data_validation->cell_column_to = ls_datavalidation-cell_column_to. + endloop. + lo_ixml_datavalidation_elem ?= lo_ixml_iterator->get_next( ). + ENDWHILE. + " End fix 276 Read data validations + endmethod. @@ -2765,10 +2844,10 @@ method RESOLVE_PATH. *--------------------------------------------------------------------* * ToDos: -* 2do§1 Determine whether the replacement should be done +* 2do§1 Determine whether the replacement should be done * iterative to allow /../../.. or something alike -* 2do§2 Determine whether /./ has to be supported as well -* 2do§3 Create unit-test for this method +* 2do§2 Determine whether /./ has to be supported as well +* 2do§3 Create unit-test for this method * * Please don't just delete these ToDos if they are not * needed but leave a comment that states this @@ -2776,14 +2855,14 @@ *--------------------------------------------------------------------* * issue #230 - Pimp my Code -* - Stefan Schmöcker, (done) 2012-11-11 +* - Stefan Schmöcker, (done) 2012-11-11 * - ... * changes: replaced previous coding by regular expression * adding comments to explain what we are trying to achieve *--------------------------------------------------------------------* *--------------------------------------------------------------------* -* §1 This routine will receive a path, that may have a relative pathname (/../) included somewhere +* §1 This routine will receive a path, that may have a relative pathname (/../) included somewhere * The output should be a resolved path without relative references * Example: Input xl/worksheets/../drawings/drawing1.xml * Output xl/drawings/drawing1.xml @@ -2791,7 +2870,7 @@ rp_result = ip_path. *--------------------------------------------------------------------* -* §1 Remove relative pathnames +* §1 Remove relative pathnames *--------------------------------------------------------------------* * Regular expression [^/]*/\.\./ * [^/]* --> any number of characters other than /