Quantcast
Channel: SCN : Discussion List - SAP for Utilities
Viewing all articles
Browse latest Browse all 2484

Unable to include Header and Footer data into excel via XML in ABAP

$
0
0

My requirement is to generate a formatted spreadsheet (with certain font size, borders, colors etc) on the shared drive (not application server) when a program is executed as a background batch job with data that is extracted from the SAP database.

 

I've formatted the data in xml and downloaded it using 'GUI_DOWNLOAD' (passing raw data).

 

My question -

How do I insert 'Header' and 'Footer' onto the excel. Note that this is not a column header but the excel header where you would regularly see a page number or document name,

 

On the excel go to -> Insert -> Header & Footer

 

This is the ABAP code i'm using -

 

Creating a ixml Factory

   l_ixml = cl_ixml=>create( ).

 

* Creating the DOM Object Model

   l_document = l_ixml->create_document( ).

 

* Create Root Node 'Workbook'

   l_element_root     = l_document->create_simple_element( name = 'Workbook'  parent = l_document ).

   l_element_root->set_attribute( name = 'xmlns'  value = 'urn:schemas-microsoft-com:office:spreadsheet' ).

 

   ns_attribute = l_document->create_namespace_decl( name = 'ss'  prefix = 'xmlns'  uri = 'urn:schemas-microsoft-com:office:spreadsheet' ).

   l_element_root->set_attribute_node( ns_attribute ).

 

   ns_attribute = l_document->create_namespace_decl( name = 'x'  prefix = 'xmlns'  uri = 'urn:schemas-microsoft-com:office:excel' ).

   l_element_root->set_attribute_node( ns_attribute ).

 

 

******************************************************************************************************************

please review this part of the code

   l_worksheetoptions = l_document->create_simple_element( name = 'WorksheetOptions' parent = l_element_root ).

   l_PageSetUp        = l_document->create_simple_element( name = 'PageSetUp' parent = l_worksheetoptions ).

   l_header           = l_document->create_simple_element( name = 'Header' parent = l_PageSetUp ).

   l_header->set_attribute( name = 'Left' value = 'HeaderTest' ).

******************************************************************************************************************

 

* Styles

   r_styles = l_document->create_simple_element( name = 'Styles'  parent = l_element_root  ).


Viewing all articles
Browse latest Browse all 2484

Trending Articles



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