Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

how to add line feed to string for XML to ecxel?

Former Member
0 Kudos

Hey guys,

i write a report which creates an excel sheet via XML string. For this purpose i use the api IF_IXML_DOCUMENT.

Now i want to add some texts to the XML which should be displayed in the created excel in one cell. The text should be formated with line feeds (in excel ALT+ENTER). How can i do this? The method which i use to write the string to XMLis:

IF_IXML_DOCUMENT->create_simple_element( )

How can i put line feed to the string, which can be interpreted as line feed in created excel? Any idea?

I tried to convert my string to a xstring and concatenate the strings with '0A'. Later i converted the concatenated xstring back to a string.

This is not working.

Other ideas?

regards,

   M.

5 REPLIES 5

matt
Active Contributor
0 Kudos

Why not use abap2xlsx, rather than re-invent the wheel.

http://wiki.sdn.sap.com/wiki/display/ABAP/abap2xlsx

Former Member
0 Kudos

I saved an excel file as XML spreadsheet 2003 (*.xml) format and opened the resulting file in notepad.

For multi-line cell text:

one

two

three

The xml file in notepad shows:

<Cell ss:StyleID="s62"><Data ss:Type="String">one&#10;two&#10;three</Data></Cell>

So I think you need to send substring &#10; as Alt+Enter indicator. No need to convert to xstring format.

0 Kudos

this is working for me. Thanks!

0 Kudos

When you add &#10; character it doesnt work. XML converts '&' into '&amp;'

I am also trying to find a solution but found nothing yet.

Former Member
0 Kudos

i find another way to do this. I placed each line in a seperate line.

thx to all.

&#10; ist not working 😞