Comments (8)
I tried to push my changes to GitHub fork and in GitHub Create a pull request. For unknown reason too many code differences due to different capitalization of keywords (and these are in the unchanged code, not in the code I pretty printed).
I give up and would want to cancel the change, it has taken way too much time already.
The suggested coding change still attached. It takes care of this issue (1195) as well as issue1199
Github-change-method CONVERT_TO_TABLE.docx
from abap2xlsx.
Hi sandraros, sorry, but I now see my copying of code into the word doc was incomplete. For 1.2.3 new it should have been:
*--------------------------------------------------------------------*
* Start of convert content
*--------------------------------------------------------------------*
lv_index = lines( me->sheet_content ) + 1. "in case iv_begin_row too big
LOOP AT me->sheet_content ASSIGNING <ls_sheet_content> WHERE cell_row >= iv_begin_row.
"iv_begin_row might be an empty row with no entries in me->sheet_content
lv_index = sy-tabix.
IF iv_empty_rows = abap_true.
DATA(lv_num_rows) = <ls_sheet_content>-cell_row - iv_begin_row.
DO lv_num_rows TIMES.
"add leading empty rows
APPEND INITIAL LINE TO <lt_data> ASSIGNING <ls_data>.
ENDDO.
ENDIF.
EXIT.
ENDLOOP.
before the loop extracting the data:
LOOP AT me->sheet_content ASSIGNING <ls_sheet_content> FROM lv_index.
AT NEW cell_row.
...
I had for SE80 exactly the pretty printer setting that you quote. When finally (with help from colleague of mine) getting my forked code uploaded to Github, it showed code with mixed case in parts of the class that I did not touch. At that point I quit and too hastily prepared the word doc that I had attached.
from abap2xlsx.
I recommend using methods, not SHEET_CONTENT directly (alas, for unknown reason, SHEET_CONTENT was not defined as READ-ONLY or private).
I have nothing against adding an optional parameter (it has been done so many times to permit improvements). Could you propose a PR please?
from abap2xlsx.
Thanks for immediate reply and your comment on SHEET_CONTENT, was wondering the same (alas, too little explanation and comments in the code for such things).
I never did any PR here. Will check in next days what that means...
from abap2xlsx.
Briefly: you have to fork the project to your GitHub account ("fork" button in GitHub), create a new branch, point ZABAPGIT to this branch, do your changes, push to your GitHub fork and then in GitHub you can click on "Create a pull request".
from abap2xlsx.
It's the problem of the Git diff which is case-sensitive and the SAP SE80 pretty printer which is unable to recognize which pretty printer method to choose (there's one by user for any repository). But ADT seems to recognize it (I never used it).
abap2xlsx requires either
- this setting in ADT (Ctrl+Shift+F1 to pretty print, it may work either on the selected lines or the whole code):
- or this SE80 setting (Shift+F1 to pretty print, it works on the whole code):
So, ADT is much better for using the pretty print of abap2xlsx.
Or you do it manually in SE80, you are helped by abapLint which checks the incorrect indenting or lower/upper case, when the pull request is created in the abap2xlsx repository. Also, note that SE80 may indent the selected lines of code by using the right context menu > Format > Format Selection.
from abap2xlsx.
Thank you. I will try to implement your code. Adding here the lines of your DOCX document.
1 ZCL_EXCEL_WORKSHEET meth. CONVERT_TO_TABLE
1.1 New optional param.
IV_EMPTY_ROWS TYPE ABAP_BOOL DEFAULT ABAP_FALSE Flag Keep empty rows
1.2 Coding change 1
1.2.1 compare
1.2.2 old
*--------------------------------------------------------------------*
* Start of convert content
*--------------------------------------------------------------------*
READ TABLE me->sheet_content TRANSPORTING NO FIELDS WITH KEY cell_row = iv_begin_row.
IF sy-subrc EQ 0.
lv_index = sy-tabix.
ENDIF.
1.2.3 new
*--------------------------------------------------------------------*
* Start of convert content
*--------------------------------------------------------------------*
lv_index = lines( me->sheet_content ) + 1. "in case iv_begin_row too big
LOOP AT me->sheet_content ASSIGNING <ls_sheet_content> WHERE cell_row >= iv_begin_row.
"iv_begin_row might be an empty row with no entries in me->sheet_content
lv_index = sy-tabix.
IF iv_empty_rows = abap_true.
DATA(lv_num_rows) = <ls_sheet_content>-cell_row - iv_begin_row.
DO lv_num_rows TIMES.
"add leading empty rows
APPEND INITIAL LINE TO <lt_data> ASSIGNING <ls_data>.
ENDDO.
ENDIF.
1.3 Coding change 2
1.3.2 old
IF <ls_data> IS INITIAL.
1.3.3 new
IF <ls_data> IS INITIAL AND iv_empty_rows = abap_false.
from abap2xlsx.
Thanks for checking!
from abap2xlsx.
Related Issues (20)
- Sometimes values of referenced Filed are empty HOT 1
- CX_SY_CONVERSION_NO_NUMBER because of conversion exit EXCRT HOT 6
- CX_SY_CONVERSION_NO_NUMBER exception in ZCL_EXCEL_READER_2007 method LOAD_WORKSHEET for multiple row spans HOT 1
- Use of Column Formula (zdemo_excel47) generates corrupted Excel HOT 10
- ZCL_EXCEL_WORKSHEET -> CONVERT_TO_TABLE wrong results if empty lines HOT 2
- Incorrect cell value when generating Excel using write_file and digits with data type "s" HOT 4
- CONVT_NO_NUMBER in ZCL_EXCEL_READER_2007=>LOAD_WORKSHEET HOT 4
- convert_to_table may produce zcx_excel/invalid time with some time values
- Reorganize zcl_excel_common unit tests, one method per test and define several test classes instead of one
- -
- Encrypt with Password HOT 1
- Position drawing in middle of a cell HOT 2
- Reading Smart Tables HOT 8
- Header/footer images and comments together make corrupted Excel file HOT 1
- Corrupted XLSX with BIND_TABLE and numeric column in TOP_LEFT_COLUMN
- Using abap2xlsx to read Excel with Excel open HOT 5
- Writer_xlsm and Writer_2007 not fully aligned again HOT 5
- Size of comments HOT 1
- Set column width via the field catalog of method BIND_TABLE
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from abap2xlsx.