c# - 从 WPF RichTextBox 获取图像和文本
问题描述
我有一个包含一些文本和图像的 WPF RichTextBox。我将如何提取所有这些并将其保存在任何地方?
目前它只能通过从 RichTextBox 获取文本来工作,但我也需要图像。这是我从 RichTextBox 中提取字符串的代码:
private string getStringFromRTB(RichTextBox rtb) {
TextRange tr = new TextRange(rtb.Document.ContentStart, rtb.Document.ContentEnd);
return tr.Text;
}
解决方案
欢迎来到 SO!
请改用TextRange.Save()
andTextRange.Load()
方法。
推荐阅读
- maven - 如何使用 Selenium java 通过 GMail 自动发送附件
- python - 将数据附加到 json 文件中的列表
- javascript - 如何在条件语句中将字符串输入字段值与单词数组进行比较
- sql - SQL Server 中的 Oracle 安全等效项
- python - 删除数据框中每一行的列中字符串中的重复单词
- python - Anaconda 不使用激活环境中的包
- javascript - Node-Express (module.exports) 变量未定义
- php - 获取属于某个模型的所有值
- python - 是否可以在现有应用程序中嵌入 Python REST API?
- ffmpeg - FFMpeg 流说明符不匹配