[英]Get images and text from WPF RichTextBox
I have a WPF RichTextBox which contains some text and images.我有一个 WPF RichTextBox,其中包含一些文本和图像。 How would I extract all of this and save it anywhere?
我将如何提取所有这些并将其保存在任何地方?
Currently it works only by getting the text from the RichTextBox, but I need images as well.目前它只能通过从 RichTextBox 获取文本来工作,但我也需要图像。 Here is the code where I extract strings from the RichTextBox:
这是我从 RichTextBox 中提取字符串的代码:
private string getStringFromRTB(RichTextBox rtb) {
TextRange tr = new TextRange(rtb.Document.ContentStart, rtb.Document.ContentEnd);
return tr.Text;
}
Welcome to SO!欢迎来到 SO!
Use the TextRange.Save()
and TextRange.Load()
methods instead.请改用
TextRange.Save()
和TextRange.Load()
方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.