Commit Graph

500 Commits

Author SHA1 Message Date
Ivan
1409cf8741 New Daily Build 2014-03-18 10:43:04 -05:00
Ivan
c2419f3896 Code Inspector improvements
Change coding issues raised by code inspector.
Still some remain to fix.
2014-03-18 10:34:13 -05:00
Ivan
d44d88a13a Merge pull request #310 from chrassig/patch-1
More sophisticated calculation of cell widths
2014-03-14 10:38:59 -05:00
chrassig
55ac5af43b More sophisticated calculation of cell widths
Let me start by saying we really love the ABAP2XLSX project. Compared to exporting CSV files and importing them to Excel, it makes transferring data from SAP systems to Excel and vice versa so much easier.

What we did not like so far was the optimization of column width, especially because of the way this is realized in the XLSX file format (why did they not just add an attribute "optimize column width = true"?). Anyway, ABAP2XLSX being an open source project, we decided to try to bring some progress to this feature.

We ended up rewriting the method CALCULATE_CELL_WIDTH of the class ZCL_EXCEL_WORKSHEET.

We added the following features:
a) Before, the calculation of the cell width in ABAP2XLSX did not take into account the fact that Excel uses a proportional font by default. Thus, columns with many "i"s ended up too wide, while columns containing many "W"s ended up not wide enough.

We now use the function module LOAD_FONT, contained in SAP package BC. Thus, it should be available in pretty much every SAP system that runs ABAP. LOAD_FONT returns an internal table containing the width of every letter known in a font. You can upload Excel's default font Calibri using transaction SM73. Make sure to upload all four files (standard, bold, italic, bold and italic) and to use the description "Calibri", i.e. exactly the name Excel displays for the font. If you want to use other fonts in your files created by ABAP2XLSX, you can of course upload other fonts as well.

We calculate the sum of the widths of all characters in a cell, and add some cell padding, similar to the way Excel does it. If the font is not available in your SAP system, we revert back to a logic similar to the old one.

As calling LOAD_FONT for every cell took several seconds when we tested with larger tables, we store the values read from the function in a hash table. Thus, we only have to call the function once for every combination of font name and font attributes used in your Excel file.

b) XLSX stores dates in a cryptic format. For dates, the current implementation calculates the width of the cryptic values, thus, the columns end up too narrow.

Fortunately, ABAP2XLSX already contains a method to transform the cryptic value into an ABAP date. We then use ABAP's WRITE statement to create a date in the format the user is preferring, and calculate the width of this formatted date.

c) ABAP2XLSX currently does not consider auto filters. Thus, a column may end up too narrow, not showing the complete header text.

We fixed this by adding a fixed value to the cell width if an auto filter is activated. We use a fixed value because the size of the auto filter button in Excel does not depend on the font size you use.

d) ABAP2XLSX only estimates the width of the characters. Excel adds a small fixed amount to the width of the characters to create some horizontal cell padding. We added cell padding as well, as this brought the cell width even closer to the values calculated by Excel.

e) ABAP2XLSX already uses ABAP's data type FLOAT to store the width of a cell. However, CALCULATE_CELL_WIDTH used data type I (integer) to calculate the cell width before. Changing the parameter type for the parameter EP_WIDTH from I to FLOAT, and adjusting the variable used by the calling method CALCULATE_COLUMN_WIDTHS in the same way, made the calculation even more precise.
2014-03-14 16:15:09 +01:00
Ivan
76bb151bbb Fix issue #308
Changed returning parameter  of method PIXEL2EMU from INT4 to STRING
2014-03-13 12:16:32 -05:00
Ivan
f52ace103a New daily build
Web Dynpro Examples are now in a separated nugget (extra)
2014-03-07 09:10:00 -06:00
Ivan
686f5c946b New daily build 2014-03-05 14:07:39 -06:00
Ivan
66f7f67943 Fix issue #296 2014-03-05 14:03:43 -06:00
Ivan
111cf14f2d Fix issue #297 2014-03-05 14:00:00 -06:00
Ivan
30ac9277f2 New daily build 2014-03-05 13:53:30 -06:00
Ivan
8adc7b3c5a New daily build 2014-03-05 13:52:05 -06:00
Ivan
a6a0430ade Fix for issue #301 2014-03-05 13:50:07 -06:00
Ivan
b1c4b450d6 Merge pull request #304 from alsp80/master
Add import of data validations (issue 276)
2014-03-05 13:31:49 -06:00
alsp80
4310280806 Add extraction of data validations 2014-03-04 22:26:54 +01:00
alsp80
8811d2c755 Add data import of data validations to reader 2014-03-04 16:34:05 +01:00
Ivan
8f4157624c New daily build 2014-02-24 16:12:43 -06:00
Ivan
ad22cf7eaf Improved memory usage and readability
Extract the parts for loading the file from application server /
presentation server into two new private methods.
Not only is the code better readable (currently, the very important LOAD
call at the end of the method almost vanishes after all that file
loading code)  - it also saves memory. Currently, when the LOAD message
is processed, not only the EXCEL_DATA xstring, but also BIN_TAB, the
auxiliary table of bytes which is retrieved from GUI_UPLOAD, is kept in
the memory as a redundant copy of the raw data, although during the
parse process it is not needed any more.
2014-02-24 16:04:18 -06:00
Ivan
169764004b Renaming huge file reader class 2014-02-24 15:32:29 -06:00
Ivan
822f9f75a3 Load file has new importing parameter for sy-batch
In the interface method ZIF_EXCEL_READER~LOAD_FILE, add an optional
import parameter I_FROM_APPLSERVER of type flag with default SY-BATCH,
and use this parameter, instead of SY-BATCH directly, for the decision
whether to load the file from application or from presentation server.
This will make the method more flexible, decoupling the decision "Where
to read the file from" from the circumstance "Am I in batch mode". By
making the parameter optional and using the default value SY-BATCH, all
existing client code will work as before.
2014-02-24 15:31:25 -06:00
Ivan
449e312c87 Suggestion by Rüdiger Plantiko
In methid ZIF_EXCEL_READER~LOAD_FILE, change the import parameter
I_FILENAME from type STRING to the generic type CSEQUENCE, and move it
to a string internally where needed.
This saves the client from having to move a CHAR field to an auxiliary
STRING field, only for not having a "type conflict" when calling the
method.
2014-02-24 15:24:18 -06:00
Ivan
d844114773 Exception class is no longer marked as final 2014-02-24 15:07:13 -06:00
Ivan
75d100150f Huge file reader by Rüdiger Plantiko
See more details in this blog
http://scn.sap.com/community/abap/blog/2014/01/27/a-way-of-reading-huge-excel-files
2014-02-24 12:11:39 -06:00
Ivan
3c85dd399c Update readme file 2014-02-21 11:04:49 -06:00
Gh14Cc10
d60745f47a Corrected Conditional Formatting bug
Conditional formatting doesn't apply font styles like bold, strikes,
underlines, color and so on.
2014-02-12 12:18:01 +01:00
Gh14Cc10
1cd76945c6 Revert "Corrected Conditional Formatting bug"
This reverts commit d01e6ab5ea.
2014-02-12 12:12:28 +01:00
Gh14Cc10
d01e6ab5ea Corrected Conditional Formatting bug
Conditional formatting font styles were not applied.
2014-02-12 12:05:03 +01:00
Gh14Cc10
cc4bb7d226 Revert "Corrected Conditional Formatting bug"
This reverts commit dda3712f23.
2014-02-12 12:03:37 +01:00
Gh14Cc10
dda3712f23 Corrected Conditional Formatting bug
Conditional formatting didn't apply font styles like color, strikes,
bold and so on. Now it is working.
2014-02-12 11:50:44 +01:00
ivanfemia
b88ba99762 Improved readme file 2014-01-02 15:13:35 -06:00
ivanfemia
33607a7293 Adding test file for ZDEMO_EXCEL29 2014-01-02 11:20:08 -06:00
ivanfemia
732fc1e4e5 Merge pull request #292 from bitdeli-chef/master
Add a Bitdeli Badge to README
2013-12-27 11:19:22 -08:00
Bitdeli Chef
99aa7fea4d Add a Bitdeli badge to README 2013-12-27 19:21:30 +00:00
ivanfemia
30990346ce remove APIDoc 2013-12-26 15:20:22 -06:00
ivanfemia
533e4c8de5 Add TOOLS and BUILD directories to the repository 2013-12-26 15:10:43 -06:00
ivanfemia
0d62589e6f Add TOOLS and BUILD directories to the repository 2013-12-26 14:51:34 -06:00
Ivan Femia
6191d1662c Mispelling license.txt
git-svn-id: https://subversion.assembla.com/svn/abap2xlsx/trunk@440 b7d68dce-7c3c-4a99-8ce0-9ea847f5d049
2013-12-16 21:29:30 +00:00
Ivan Femia
cc9f7ab043 Licence update to Apache 2.0
git-svn-id: https://subversion.assembla.com/svn/abap2xlsx/trunk@439 b7d68dce-7c3c-4a99-8ce0-9ea847f5d049
2013-12-16 21:28:07 +00:00
Ivan Femia
cd5e43193b Databar Conditional Formatting by Albert Lladanosa
git-svn-id: https://subversion.assembla.com/svn/abap2xlsx/trunk@437 b7d68dce-7c3c-4a99-8ce0-9ea847f5d049
2013-10-31 21:05:10 +00:00
Ivan Femia
3bae68f551 Set to Test #292
git-svn-id: https://subversion.assembla.com/svn/abap2xlsx/trunk@434 b7d68dce-7c3c-4a99-8ce0-9ea847f5d049
2013-09-16 23:20:17 +00:00
Ivan Femia
427ca5c4d8 Fixed #291
git-svn-id: https://subversion.assembla.com/svn/abap2xlsx/trunk@433 b7d68dce-7c3c-4a99-8ce0-9ea847f5d049
2013-09-16 23:17:04 +00:00
Ivan Femia
5c6995fe90 Test #290
It is possible to specify a formula in the field catalog instead of a value (BIND_TABLE)

git-svn-id: https://subversion.assembla.com/svn/abap2xlsx/trunk@432 b7d68dce-7c3c-4a99-8ce0-9ea847f5d049
2013-09-11 22:07:48 +00:00
Ivan Femia
805472ee61 Ready to test #289 new parameter in the table setting
git-svn-id: https://subversion.assembla.com/svn/abap2xlsx/trunk@431 b7d68dce-7c3c-4a99-8ce0-9ea847f5d049
2013-09-11 21:07:09 +00:00
Rene Turnheim
efc9e39f11 Fixed #287 issue. Correct some old problems with langu="1" and add new functions as options for converter:
Hide column
No header
No subtotal
No filter
This can later be added to bind_alv method.

git-svn-id: https://subversion.assembla.com/svn/abap2xlsx/trunk@429 b7d68dce-7c3c-4a99-8ce0-9ea847f5d049
2013-08-11 18:48:00 +00:00
Stefan Schmöcker
efedac0571 #284: Added support of reading XLSX-Files where the formulae are not stated explicitly but by reference to another cell holding a reference formula. Thanks to David for supplying the method to shift a formula to another cell.
Enhanced Demoreport 6 to demonstrate how this new method can be used in other circumstances then reading in an EXCEL-sheet


set to test #268:  Changed unit-test to make use of the extended functionality in ZCX_EXCEL

git-svn-id: https://subversion.assembla.com/svn/abap2xlsx/trunk@428 b7d68dce-7c3c-4a99-8ce0-9ea847f5d049
2013-08-11 10:43:02 +00:00
Stefan Schmöcker
44fa9a6558 Preparations to advance #268
Adding messageclass to enable multilingual exceptions and messages and better cross-referencing.
Enhancing ZCX_EXCEL to have a substitute for non-classbased "message .... raising"
and to enable unittests that are independant of logonlanguage when checking exceptions raised this way.

git-svn-id: https://subversion.assembla.com/svn/abap2xlsx/trunk@427 b7d68dce-7c3c-4a99-8ce0-9ea847f5d049
2013-08-10 21:32:38 +00:00
Gregor Wolf
5035be62e6 Ready to test #271 used standard image from transaction SMW0
git-svn-id: https://subversion.assembla.com/svn/abap2xlsx/trunk@426 b7d68dce-7c3c-4a99-8ce0-9ea847f5d049
2013-07-15 18:08:24 +00:00
Gregor Wolf
7d41f42521 Ready to test #271 used standard image from transaction SMW0
git-svn-id: https://subversion.assembla.com/svn/abap2xlsx/trunk@425 b7d68dce-7c3c-4a99-8ce0-9ea847f5d049
2013-07-15 17:58:40 +00:00
Alessandro Iannacci
7cb0888b86 Excel of demo 39 has validation issue ready to test #276
git-svn-id: https://subversion.assembla.com/svn/abap2xlsx/trunk@423 b7d68dce-7c3c-4a99-8ce0-9ea847f5d049
2013-06-19 16:12:22 +00:00
Gregor Wolf
9448918fa0 Add unit test to ZCL_EXCEL_COMMON=>DESCRIBE_STRUCTURE and fix empty fieldname for DDIC element
Ready to test #270 ZCL_EXCEL_COMMON=>DESCRIBE_STRUCTURE not covered in unit test

git-svn-id: https://subversion.assembla.com/svn/abap2xlsx/trunk@422 b7d68dce-7c3c-4a99-8ce0-9ea847f5d049
2013-05-24 10:45:23 +00:00
Gregor Wolf
d84f04f8ac Add unit test for issue #241 Error in ZCL_EXCEL_COMMON=>CONVERT_RANGE2COLUMN_A_ROW
git-svn-id: https://subversion.assembla.com/svn/abap2xlsx/trunk@421 b7d68dce-7c3c-4a99-8ce0-9ea847f5d049
2013-05-24 09:20:06 +00:00