question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Adding an image as per MSDN docs makes the file unreadable by Word for Office 365 (Windows)

See original GitHub issue

Description

When creating a basic WordprocessingDocument using instructions from: https://docs.microsoft.com/en-us/office/open-xml/how-to-insert-a-picture-into-a-word-processing-document the document cannot be opened by the MS Word application specifically Microsoft Word for Office 365 MSO (16.0.12527.20986) (version 2002) on Windows 10 (also tested on macOS using the Word for Office 365 as well).

When opening the warning monit appears: Word experienced an error trying to open the file.

The same file opens fine in Office 365 Online.

Information

  • .NET Target: .NET Core 3.1
  • DocumentFormat.OpenXml Version: 2.11.3

Repro Wrote a minimal reproduction. Generated ‘test.docx’ is unopenable by the mentioned Word application.

https://github.com/p-kaczynski/OpenXmlImageRepro

I have tried a number of things, like including/omitting editId, anchorId etc. vs the base code from MSDN, but the result is always the same.

Observed

An error when opening the file using Word for Office 365 on Windows/Mac

Please note, that posibly the same issue was reported on SO by someone else very recently: https://stackoverflow.com/questions/63529065/inserting-image-corrupts-open-xml-sdk-generated-word-file

Expected

The document should open correctly.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6

github_iconTop GitHub Comments

5reactions
p-kaczynskicommented, Sep 1, 2020

Ok, found the issue.

This line in the MSDN docs:

                     ) { Uri = "https://schemas.openxmlformats.org/drawingml/2006/picture" })

is invalid, because of the https that should be http.

Changing that makes the document open without issue.

2reactions
tomjebocommented, Mar 16, 2021

@sdudnic @p-kaczynski it looks like the PR only changes one instance of the “https” error. There are several instances in the example code in that document and these should all be fixed. That doesn’t explain why the one instance your commit fixed didn’t get changed. Perhaps it takes time to publish? I can follow up with the content owner to check on that but you might want to update or submit another PR to fix all the occurrences of “https”.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Adding an image as per MSDN docs makes the file ...
An error when opening the file using Word for Office 365 on Windows/Mac. Please note, that posibly the same issue was reported on...
Read more >
Word found unreadable content in......URGENT HELP ...
Navigate to File tab > Open > Browse > On the Microsoft Open window, select the unreadable word files and choose Recover Text...
Read more >
How to Fix the “Word Found Unreadable Content” Error
Launch Microsoft Word. · Go to File > Options. · Select Trust Center > Trust Center Settings. · From the left-hand menu, open...
Read more >
We Found Unreadable Content Error in Word: How to Fix
Seeing a "We found unreadable content" error while trying to open a Word document? Follow the steps in this guide to fix the...
Read more >
Configure | Citrix Workspace app for Windows
Open the Citrix Workspace app Group Policy Object administrative template by running gpedit.msc . Under the Computer Configuration node, go to ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found