You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/development/xlsx.md
+166-7Lines changed: 166 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,17 +3,176 @@ outline: [2, 6]
3
3
---
4
4
# XLSX
5
5
6
-
<iclass="fa-brands fa-github"></i> [XLSX Addon on GitHub](https://github.com/abap2UI5-addons/xlsx)
6
+
The abap2UI5 framework, being purely ABAP, allows you to leverage the existing XLSX features of your ABAP system seamlessly. You can implement file uploads or downloads, converting the contents of XLSX files into internal ABAP tables or exporting tables to XLSX files. This add-on simplifies the process with APIs and examples.
7
7
8
-
Since abap2UI5 is a pure ABAP framework, you can easily leverage the existing XLSX features of your ABAP system. <br>
9
8
10
-
In ABAP Cloud, you can use the new APIs provided by the `XCO_CP_XLSX`classes. <br>
9
+
#### Download
11
10
12
-
In ABAP Classic, there are several ways to handle XLSX files. However, to stay on the open-source path, consider using the excellent project [abap2xlsx](https://github.com/abap2xlsx) — you’ll find no easier solution! <br>
11
+
Convert an internal table to an XLSX file and download it as a Base64-encoded file:
13
12
14
-
Then with abap2UI5, you only need to implement a file upload and transfer the contents of the XLSX file into an internal ABAP table or vice versa. This add-on provides APIs and examples to simplify your development. <br>
13
+
::: code-group
15
14
15
+
```abap
16
+
METHOD z2ui5_if_app~main.
16
17
17
-
#### XCO API (cloud)
18
+
client->view_display( z2ui5_cl_xml_view=>factory(
19
+
)->page(
20
+
)->button(
21
+
text = 'Open Download Popup'
22
+
press = client->_event( 'BUTTON_DOWNLOAD' )
23
+
)->stringify( ) ).
18
24
19
-
#### abap2xlsx (classic)
25
+
26
+
CASE client->get( )-event.
27
+
28
+
WHEN 'BUTTON_DOWNLOAD'.
29
+
30
+
TYPES:
31
+
BEGIN OF ty_row,
32
+
count TYPE i,
33
+
value TYPE string,
34
+
descr TYPE string,
35
+
END OF ty_row.
36
+
TYPES ty_tab TYPE STANDARD TABLE OF ty_row WITH EMPTY KEY.
37
+
38
+
DATA(lt_tab) = VALUE ty_tab(
39
+
( count = '1' value = `red` descr = `this is a description` )
40
+
( count = '2' value = `red` descr = `this is a description` )
41
+
( count = '3' value = `red` descr = `this is a description` )
42
+
( count = '4' value = `red` descr = `this is a description` )
43
+
( count = '5' value = `red` descr = `this is a description` ) ).
result = lo_excel->if_fdt_doc_spreadsheet~get_itab_from_worksheet( lt_worksheets[ 1 ] ).
167
+
168
+
ENDMETHOD.
169
+
170
+
ENDCLASS.
171
+
```
172
+
::: code-group
173
+
174
+
For advanced functionality, consider leveraging the wonderful open-source project [abap2xlsx](https://github.com/abap2xlsx/abap2xlsx), which offers reusable APIs for all common XLSX operations.
175
+
176
+
::: tip **ABAP Cloud**
177
+
The snippets provided above are not compatible with ABAP Cloud. Use the XCO_CP_XLSX APIs for such scenarios.
0 commit comments