Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Demo report of numbers with various decimal places #15

Open
gsharpe2000 opened this issue Nov 12, 2015 · 7 comments
Open

Demo report of numbers with various decimal places #15

gsharpe2000 opened this issue Nov 12, 2015 · 7 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@gsharpe2000
Copy link

I've looked at ZDEMO_EXCEL30 for hints on how to use the decimal places but it's not working for me when data is coming from SAP sources.

For example, when I have a value of .90, the spreadsheet shows .9 and the customer wants to see .90

I've used the following and it's not working.
lo_worksheet->set_cell( ip_column = lv_col ip_row = lv_row ip_value = l_charact-qcres-mvalue
ip_abap_type = lc_typekind_packed ).

l_charact-qcres-mvalue is type CHAR132 coming from SAP database.

I've also tried lc_typekind_num without success.

Has any one else had this issue and if so, how did they fix it?

Regards,

Greg Sharpe

@gsharpe2000
Copy link
Author

Sorry, I also tried changing to another field with NNNN.NN and still the spreadsheet only shows .9

Greg

@PekkaPee
Copy link

Hi,

I struggle with the same requirement. Anyone have a solution to offer?

Br,
Pekka

@rmcknight001
Copy link

rmcknight001 commented Jan 30, 2017 via email

@PekkaPee
Copy link

Those masks work perfectly. Thanks, now I can skip workarouds :)

Br,
Pekka

@gregorwolf
Copy link

@rmcknight001 perhaps you can contribute that as a demo report?

@PekkaPee
Copy link

Hello,

Report is way too big to put out, but I just did as rmcknight001 suggested. Declared all masks as global constants and created styles according to them. I did not have to use dd04l, since I knew that all values have 2 decimals.

*Row, type number
go_style_row_nro = go_excel->add_new_style( ).
go_style_row_nro->font->size = 11.
go_style_row_nro->number_format->format_code = gc_style_decimals_2z.
gv_style_row_nro_guid = go_style_row_nro->get_guid( ).

And

*Colored row type number
go_style_row_nro_color = go_excel->add_new_style( ).
go_style_row_nro_color->font->size = 11.
go_style_row_nro_color->fill->filltype = zcl_excel_style_fill=>c_fill_solid.
go_style_row_nro_color->fill->fgcolor-rgb = 'FFCCFFFF'.
go_style_row_nro_color->number_format->format_code = gc_style_decimals_2z.
gv_style_row_nro_color_guid = go_style_row_nro_color->get_guid( ).

Then used these normally with set cell
go_worksheet->set_cell( ip_column = gv_col
ip_row = lv_row
ip_value = lv_dec2
ip_style = gv_style_row_nro_color_guid ).

Format codes which came with the abap2xlsx-package did not work as desired.

Br,
Pekka

@rmcknight001
Copy link

rmcknight001 commented Jan 31, 2017 via email

@sandraros sandraros changed the title Default number of decimal places in XLSX Demo report of numbers with various decimal places Dec 1, 2021
@sandraros sandraros added enhancement New feature or request help wanted Extra attention is needed labels Dec 1, 2021
@AndreaBorgia-Abo AndreaBorgia-Abo transferred this issue from abap2xlsx/abap2xlsx Aug 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

5 participants