我有 RTF 格式的文档模板,它包含一些文本和一些图像(使用写字板,Win 7 创建)。我需要更改一些文本并保存它。我正在尝试这样做(Delphi XE7,Win32 平台,Windows 7 x64 SP1):
RichEdit1.Lines.LoadFromFile('1.rtf');
RichEdit1.Lines.SaveToFile('2.rtf');
所以我还没有改变任何东西,但是 2.rtf 不再包含任何图像,并且尺寸比 1.rtf 小得多。其他一切(表格/文本/字体/...)似乎都还可以。任何想法如何保存所有图像(和其他对象)?
更新1。刚刚找到解决方法。我有 DevExpress 组件,如果我使用 TcxRichEdit 而不是 TRichEdit,那么我可以保留所有对象:
cxRichEdit1.Properties.AllowObjects := True;
cxRichEdit1.Lines.LoadFromFile('e:\Work\InvoiceGenerator\bin\Invoice2.rtf');
cxRichEdit1.Lines.SaveToFile('e:\Work\InvoiceGenerator\bin\Invoice3.rtf');
但我在 TRichEdit 中找不到类似的功能。