如何在Delphi中将带有图像的RichText(RTF)文档转换为HTML? [英] How to convert RichText (RTF) document with images into HTML in Delphi?

查看:209
本文介绍了如何在Delphi中将带有图像的RichText(RTF)文档转换为HTML?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试找到一个免费的(最好是开源的)组件或库,该组件或库可以将带有嵌入式图像的RTF文件转换为HTML文件和图像文件,或者转换为更好的HTML和图像流。

I have been trying to find a free (preferably open sourced) component or library which will allow to convert a RTF file with embedded images into HTML file and image files or better HTML and image streams.

完美的解决方案,无论它是DLL库还是Delphi组件,都将允许使用回调将数据流传输到IStream / TStream,因此我将能够将图像转换并保存为选择的格式返回图像文件的相对名称以供RTF解析器包含在生成的HTML文件中,但是按原样保存也很好,尤其是在将代码开源的情况下。

The perfect solution, regardless if it is a DLL library or Delphi component, would allow to stream data to IStream/TStream using callbacks, so I will be able to convert and save images into a format of choice returning image file relative name for RTF parser to include in generated HTML file, yet saving as-is is also good especially when code would be open sourced.

商业解决方案,但我很难考虑它们,因为(相对)简单地将一种文档类型转换为另一种文档的价格很高,而且两种格式都使用了20年,这表明必须存在现有的库(本机,非托管)才能进行这种转换。

I have came across commercial solutions yet I struggle to consider them because prices for a (relatively) simple conversion of one document type into another are quite high and both formats are 20 years old which suggests there must be existing library (native, not managed) to make such conversion.

如果找不到解决方案,我可能会转换将此代码转换为Delphi dll并使其可用,但是也许有人已经这样做了?

If I won't find a solution, I will probably convert this code into Delphi dll and make it available, but maybe someone already did it?

编辑:

我们决定使用上述.Net RtfConverter 编译为DLL,从中生成Delphi TLB单元,并迫使客户安装.Net框架(嵌入在安装程序中)。现在,转换就像是一种魅力,另一个迹象表明是时候从Delphi转到.Net了。

We've decided to use aforementioned .Net RtfConverter compiled as a DLL, generate Delphi TLB unit from it and force customers to install .Net framework (embedded in installer). Now conversion works like a charm, another sign it's time to move on to .Net from Delphi...

推荐答案

如果可以的话使用Microsoft Office打开RTF,然后将其另存为HTML,然后在后台运行,那么我相信这是您最好的解决方案,只需使用OLE在后台触发Microsoft Word实例,加载RTF,然后将其导出为HTML ...

If you COULD use microsoft office to open the RTF and then save it as HTML in the background, then I believe this is your best solution, just fire a Microsoft Word instance in the background using OLE, load the RTF and then export it as HTML...

这篇关于如何在Delphi中将带有图像的RichText(RTF)文档转换为HTML?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆