0

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. 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:

  • Google Docs preview functionality
  • Windows Phone 8.1 (which has Office functionality built in)
  • Various iOS and Android viewers

In all cases, the document displays completely correctly except that the RTF content is just missing.

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.

It's a bit of an obscure case so trying to figure out the problem is proving difficult.

Community
  • 1
  • 1
Mr. Boy
  • 60,845
  • 93
  • 320
  • 589

1 Answers1

0

The technique you used (altChunk) relies on the viewer to convert the RTF content into 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.

JasonPlutext
  • 15,352
  • 4
  • 44
  • 84
  • So you think it is a limitation of the viewers then? That seems odd, because in OOXML files images are also separate files referenced from the XML, and that works. I noted if I open the .docx file and make a tiny edit (not in the embedded content) and re-save, now the viewers work. Guess I need to diff the main XML file in the archives... – Mr. Boy Apr 11 '15 at 14:44
  • When you open it in Word, it converts it to normal WordML, which the viewers can of course handle. (Not sure why you mention images? The issue here is whether a viewer can handle an Alternative Format Input Part, not an image part) – JasonPlutext Apr 13 '15 at 09:26