简体   繁体   English

如何在Windows Phone 8.1中显示rtf?

[英]How to display rtf in Windows Phone 8.1?

I am working on a News Application on WP8.1 and news body text is formatted as rtf. 我正在WP8.1上的新闻应用程序上工作,新闻正文文本的格式设置为rtf。 And below is a sample body text of a news item. 下面是新闻条目的示例正文。 But I cannot display body text as formatted before in Windows Phone. 但是我无法在Windows Phone中以以前的格式显示正文。

{\\rtf1\\fbidis\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fswiss\\fprq2\\fcharset0 Arial;}{\\f1\\fnil\\fcharset0 Microsoft Sans Serif;}} {\\colortbl ;\\red0\\green0\\blue0;\\red255\\green0\\blue0;\\red255\\green255\\blue0;} \\viewkind4\\uc1\\pard\\ltrpar\\sl276\\slmult1\\cf1\\highlight2\\lang2055\\ul\\b\\f0\\fs20 Test for \\highlight3 RTF\\highlight0 RTF TEST TETST \\par \\highlight3 www.google.com\\highlight0\\par \\pard\\ltrpar\\cf0\\lang1033\\ulnone\\b0\\f1\\fs17\\par } {\\ rtf1 \\ fbidis \\ ansi \\ ansicpg1252 \\ deff0 \\ deflang1033 {\\ fonttbl {\\ f0 \\ fswiss \\ fprq2 \\ fcharset0 Arial;} {\\ f1 \\ fnil \\ fcharset0 Microsoft Sans Serif;}} {\\ colortbl; \\ red0 \\ green0 \\ blue0; \\ red255 \\ green0 \\ blue0; \\ red255 \\ green255 \\ blue0;} \\ viewkind4 \\ uc1 \\ pard \\ ltrpar \\ sl276 \\ slmult1 \\ cf1 \\ highlight2 \\ lang2055 \\ ul \\ b \\ f0 \\ fs20测试\\ highlight3 RTF \\ highlight0 RTF测试测试\\ par \\ highlight3 www.google.com \\ highlight0 \\ par \\ pard \\ ltrpar \\ cf0 \\ lang1033 \\ ulnone \\ b0 \\ f1 \\ fs17 \\ par}

How can I display rtf above in WP ? 如何在WP中显示以上rtf? Thanks in advance. 提前致谢。

A Windows Phone Runtime app can display RTF in a RichEditBox : Windows Phone运行时应用程序可以在RichEditBox中显示RTF:

RichEditBox1. RichEditBox1。 Document . 文件 SetText ( TextSetOptions .FormatRTF,rtfString); SetTextTextSetOptions .FormatRTF,rtfString);

See Quickstart: Adding text input and editing controls and the XAML text editing sample for more info. 有关更多信息,请参见快速入门:添加文本输入和编辑控件以及XAML文本编辑示例

There isn't an in-box RTF control for Silverlight apps, but for simple RTF you can parse it yourself and then load the blocks into a RichTextBox . Silverlight应用程序没有内置的RTF控件,但是对于简单的RTF,您可以自己解析它,然后将块加载到RichTextBox中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM