Skip to Content
0

[abap2xlsx] Get cell value with cell style

Nov 02, 2017 at 02:47 PM

67

avatar image
Former Member

Hello,

I'm trying to read the value of an excel cell. The cell has a date style and I use the following code:

lo_worksheet->get_cell( EXPORTING ip_column = lv_col_act ip_row = lv_row_act IMPORTING ep_value = DATA(lv_excel_value) ep_style = DATA(lv_style) ).

Instead of getting the excel value (for example "20.07.2017") I'm getting only a number and the lv_style variable is filled.

How do I get the real excel value for cells with a style?

Thanks in advance.

Best regards

Daniel

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Sandra Rossi Nov 02, 2017 at 06:08 PM
1

There is the method ZCL_EXCEL_COMMON=>EXCEL_STRING_TO_DATE which converts the Excel value into an ABAP Date variable (type D).

Share
10 |10000 characters needed characters left characters exceeded
Mike Pokraka Nov 02, 2017 at 03:35 PM
0

That is the real cell value, Excel stores dates & times as serial numbers, The style just tells Excel to display it in date format. If you change the cells in Excel to use general then you will see the same numbers.

If you convert them to ABAP dates, be aware of a little featurebug if using an old reference date. Here's a blog describing the issue: Link

Share
10 |10000 characters needed characters left characters exceeded