简体   繁体   English

使用OpenXML将RTF文件嵌入DOCX文件时,嵌入的内容在某些查看器中不显示

[英]When embedding RTF file into DOCX file using OpenXML, embedded contents don't display in some viewers

Using the technique in this answer I was successfully embedding the contents of an RTF file into an existing Word DOCX file, using OpenXML 2.5. 使用此答案中的技术,我使用OpenXML 2.5成功地将RTF文件的内容嵌入到现有的Word DOCX文件中。 Or so I thought. 还是我想。

We've now discovered that while the created file works fine in MS Word and Word Online, the document displays without the RTF content on other viewers such as: 现在我们发现,虽然创建的文件在MS Word和Word Online中可以正常工作,但是在其他查看器上显示的文档中没有RTF内容,例如:

  • Google Docs preview functionality Google文件预览功能
  • Windows Phone 8.1 (which has Office functionality built in) Windows Phone 8.1(内置了Office功能)
  • Various iOS and Android viewers 各种iOS和Android查看器

In all cases, the document displays completely correctly except that the RTF content is just missing. 在所有情况下,除了仅缺少RTF内容外,文档都可以完全正确显示。

I did think it might be an issue in the viewers rather than the DOCX file, but for several tools to have the same issue makes me suspect it is a bug in our code. 我确实认为这可能是查看器中的问题,而不是DOCX文件,但是对于一些具有相同问题的工具,我怀疑这是我们代码中的错误。

It's a bit of an obscure case so trying to figure out the problem is proving difficult. 这是一个晦涩难懂的案例,因此试图找出问题很困难。

The technique you used (altChunk) relies on the viewer to convert the RTF content into WordML. 您使用的技术(altChunk)依赖查看器将RTF内容转换为WordML。

As you've discovered many don't do this. 正如您所发现的,很多人都不会这样做。

To avoid this issue, you've really gotta convert the RTF content in your own code. 为避免此问题,您确实必须在自己的代码中转换RTF内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM