我在RichTextBox中有一些文本。此文本包含标签,例如:[@TagName!]。我想用数据库中的一些数据替换这些标签而不丢失格式(字体、颜色、图像等)。我创建了一个方法:voidReplaceTagsWithData(FlowDocumentdoc){FileStreamfs=newFileStream("tmp.xml",FileMode.Create);TextRangetrTextRange=newTextRange(doc.ContentStart,doc.ContentEnd);trTextRange.Save(fs,DataFormats.Xaml);fs.Dispo
我在RichTextBox中有一些文本。此文本包含标签,例如:[@TagName!]。我想用数据库中的一些数据替换这些标签而不丢失格式(字体、颜色、图像等)。我创建了一个方法:voidReplaceTagsWithData(FlowDocumentdoc){FileStreamfs=newFileStream("tmp.xml",FileMode.Create);TextRangetrTextRange=newTextRange(doc.ContentStart,doc.ContentEnd);trTextRange.Save(fs,DataFormats.Xaml);fs.Dispo