- 我想读取一个 Word 文件(包含图像和表格)。
- 之后,我想将其内容转换为“RFC 822 格式”。
寻找上面的一些 APIS 和示例代码。
RFC 822不是您正在寻找的规范。
RFC 5322的摘要揭示了一个原因:
This document specifies the Internet Message Format (IMF), a syntax
for text messages that are sent between computer users, within the
framework of "electronic mail" messages. This specification is a
revision of Request For Comments (RFC) 2822, which itself superseded
Request For Comments (RFC) 822, "Standard for the Format of ARPA
Internet Text Messages", updating it to reflect current practice and
incorporating incremental changes that were specified in other RFCs.
第 1.1 节(“范围”)的这一段揭示了另一个:
This document specifies a syntax only for text messages. In
particular, it makes no provision for the transmission of images,
audio, or other sorts of structured data in electronic mail messages.
There are several extensions published, such as the MIME document
series ([RFC2045], [RFC2046], [RFC2049]), which describe mechanisms
for the transmission of such data through electronic mail, either by
extending the syntax provided here or by structuring such messages to
conform to this syntax. Those mechanisms are outside of the scope of
this specification.
我认为您实际上想要另一个问题的答案,例如:
如何将 Word 消息转换为在各种邮件用户代理中看起来不错的基于 MIME 的格式?
如果我错了,并且您确实在问如何将 Word 文档转换为纯文本电子邮件,您可能应该看看antiword,这是一个用于将 Word 文档转换为纯文本、PostScript、PDF 或 docbook 的功能强大的工具。(虽然没有迹象表明它可以在输出纯文本时对图像做任何事情——然而,无论如何。)
从Microsoft Office的 Open XML SDK 2.0 开始读取 Word 文件。