gpt4 book ai didi

asp.net - 如何使用 ASP.Net 将 Rtf 转换为文本?

转载 作者:行者123 更新时间:2023-12-04 03:21:11 24 4
gpt4 key购买 nike

如何使用 ASP.Net 从 RTF 格式转换为文本格式?

最佳答案

您有关于 MSDN 的说明

在 C# 中

class ConvertFromRTF
{
static void Main()
{

string path = @"test2.rtf";

//Create the RichTextBox. (Requires a reference to System.Windows.Forms.dll.)
System.Windows.Forms.RichTextBox rtBox = new System.Windows.Forms.RichTextBox();

// Get the contents of the RTF file. Note that when it is
// stored in the string, it is encoded as UTF-16.
string s = System.IO.File.ReadAllText(path);

// Display the RTF text.
System.Windows.Forms.MessageBox.Show(s);

// Convert the RTF to plain text.
rtBox.Rtf = s;
string plainText = rtBox.Text;

// Display plain text output in MessageBox because console
// cannot display Greek letters.
System.Windows.Forms.MessageBox.Show(plainText);

// Output plain text to file, encoded as UTF-8.
System.IO.File.WriteAllText(@"output.txt", plainText);
}
}

关于asp.net - 如何使用 ASP.Net 将 Rtf 转换为文本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/407689/

24 4 0
文章推荐: deployment - WAR 部署中缺少 Wildfly DefaultJMSConnectionFactory
文章推荐: cygwin - 在Mintty的Cygwin窗口缓冲区中搜索
文章推荐: knockout.js - ko.computed 不会在实例化时触发函数
文章推荐: asciidoctor - AsciiDoctor 中的自定义(多列)
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com