I agree with Peter. There's no guarantee, that even if Escapechar did work for changing style, etc, that Escapechar+n would write the same thing that Excel writes for the Alt+Enter (which is what you have to use to put a return into an Excel cell -- outside the world of SAS.)
In fact, when I made a test spreadsheet and saved the file as XML, this is what I got from Excel (in the XML) for the cell:
[pre] ccc ddd
It looks to me like is some kind of named entity (like ) that represents ALT+Enter.
It also looks like Excel is setting the Wrap attribute on the s21 style:
But, when I tried to use that string in a cell, even with protectspecialchars=off, Excel did not translate my to a return. Perhaps there is a hex code equivalent of that string which would work better. I frequently find that some things Microsoft does in its own XML I am unable to duplicate.
Thanks for the help. I got it to work by specifying protectspecialchar=no and using the actual CR value instead of the ods escapechar (replace the "?" with a "&"). What are the consequences of my turning off protectspecialchar? Can I get around any potential issues by just using the htmlencode function?
x = "aaa?#10;bbb";
define style styles.test;
replace Document from Container /
protectspecialchars = off
For what you're doing, I suspect there are no real consequences to using protectspecialchars=off. Generally, when protectspecialchars=on, a character like > used in a TITLE:
[pre]title 'Sales > 500';[/pre]
would be "protected" by being translated to > Of course, only you know your data and how important it is to have a CR in your data. It's a tradeoff. And benchmarking or thoroughly reviewing your output is the only method that can reveal the consequences of protectspecialchars=off.