C#Web应用程序中的RTF到Plantext的转换 [英] RTF to Plantext conversion in C# webapplication

查看:108
本文介绍了C#Web应用程序中的RTF到Plantext的转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我需要有关转换的帮助
在我的c#Web应用程序中,有一个多行文本框并接受文本列表.
文本清单是例外处理.我想包含一个功能,例如:
如果用户复制将RTF文件中的RTF文本粘贴到我的应用程序的文本框中.
它应该自动将输入的数据转换为计划文本. (特别需要单引号('')的功能)
我遇到的问题:
1.无法将文本框转换为rtf文本框,因为用户也可以输入plantext.

请帮助

谢谢,
Shital

Hi,

I need help related to conversion
In my c# web application, There is a multiline text box and accepts list of text.
List of text is process as excepted. i want to include a feature such as:
If user copy paste the RTF text from RTF file in my application''s text box.
It should automatically convert entered data into plan text. (Specially wants a feature for apostrophe (''))
Problem i faced:
1.Cant convert textbox to rtf text box because user can enter plantext also.

Plz help

Thanks,
Shital

推荐答案

用户可以将RTF文本粘贴到纯文本框控件中.结果将是纯文本.无需转换.

我不认识撇号问题.我不认为存在这样的问题? Unicode中有四种不同的撇号,其中只有一种用于ASCII,0x27,其余三种用于0x2BC(修饰符撇号),0x55​​A(美国)和0xFF07(全角).您需要将转换为ASCII还是其他?您可能不需要它,因为它与RTF或纯文本无关-都支持Unicode.

现在,您可以始终将TextBox.Text转换为RTF,而无需任何RTF格式数据.如果数据丢失,它也会丢失.您需要将RichTextBox.TextRichTextBox.SelectedText分配给纯文本. (注意:属性RichTextBox.RtfRichTextBox.SelectedRtf允许分配带格式说明符的富文本.)

—SA
The user can paste RTF text in a plain text box control; the result will be plain text. No conversion is required.

I do not recognize apostrophe problem. I don''t think such problem exist? There are four different apostrophes in Unicode, only one of them is used in ASCII, 0x27, three others as 0x2BC (modifier letter apostrophe), 0x55A (American) and 0xFF07 (full-width). Do you need to convert the to ASCII or something else? You probably don''t need it, as it has nothing to do with RTF or plain text — both support Unicode.

Now, you can always convert TextBox.Text to RTF without any RTF formatting data. If data is lost it is lost. You need to assign RichTextBox.Text or RichTextBox.SelectedText to your plain text. (Note: properties RichTextBox.Rtf and RichTextBox.SelectedRtf allow to assign rich text, with formatting specifiers.)

—SA


感谢回复.

但是随着我对字符的int值的理解,它们会以不同的方式出现.

富文本撇号:‘":8216

富文本撇号:’":8217

植物文字撇号:":39

我的项目中使用了第三方软件,它检测富文本撇号是一个特殊字符,并允许对其进行处理.

到我无声地规范我的文本并将Rich文本撇号转换为纯文本撇号时.
Thanks for the reply.

But with i will take int value of the character they comes out differently.

Rich text apostrophe : "‘" :8216

Rich text apostrophe : "’" :8217

Plant text apostrophe : "''" :39

there are third party s/w used in my project , and its detecting rich text apostrophe as a special character and allow to processed.

by the time i silently normalized my text and converted Rich text apostrophe to plain text apostrophe.


这篇关于C#Web应用程序中的RTF到Plantext的转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆