Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 2796

Re: Corrupt Office 2007 files (.docx .xlsx) when downloading

$
0
0

Hi,

 

Please use below class's method to generate XSTRING

 

  cl_fdt_xl_spreadsheet=>if_fdt_doc_spreadsheet~create_document(

     EXPORTING

       itab          = lr_data "(reference to the internal table to be printed)

       iv_call_type  = 2

       columns       = lt_column "(Column table)

     RECEIVING

       xdocument     = lv_xstring ).


To populate lt_column, you can use  LVC_FIELDCATALOG_MERGE FM. After lt_column is filled you need to populate it's additional parameters as below-


* Creating XLSX spreadsheet field list

   LOOP AT lt_fieldcat INTO ls_fieldcat.

     CLEAR ls_column.

     ls_column-id        = sy-tabix.

     ls_column-name      = ls_fieldcat-fieldname.

     ls_column-is_result = abap_true.

 

*   Getting the field information for excel field

     lr_string     ?= cl_abap_datadescr=>describe_by_data( ls_fieldcat-fieldname ).

     ls_column-type = lr_string.

 

*   Reading the field label from structure's label

    ls_column-display_name = <description text here>. "text

   

     APPEND ls_column TO lt_column.

   ENDLOOP.


I hope this works for XLSX, it worked for me. The only disappointment is, it takes some extra time.


Thanks

Mohit


Viewing all articles
Browse latest Browse all 2796

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>