I want to share some text using mail client on windows 8, in which I want to display new lines. It displays it correctly in notepad on using \r\n
but doesn't work with the SetText
function in DataTransferManager
.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
The key is to set text in HTML and not send it as string.
Suppose the text you want to share is in string textToShare;
Note that you will be sending a string in HTML, so you need to replace all new line characters with <br/>
instead of
theRequest.Data.SetText(textToShare);
use
theRequest.Data.SetHtmlFormat(HtmlFormatHelper.CreateHtmlFormat(textToShare));