Bug 163391 - Opening a DOCX file with relative image path - the image is missing
Summary: Opening a DOCX file with relative image path - the image is missing
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: DOCX DOC-Images VML-Shapes
  Show dependency treegraph
 
Reported: 2024-10-11 15:00 UTC by Rose
Modified: 2024-10-13 22:40 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
docx, doc and the image file in the correct structure we use (211.88 KB, application/x-zip-compressed)
2024-10-11 15:00 UTC, Rose
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rose 2024-10-11 15:00:43 UTC
Created attachment 197007 [details]
docx, doc and the image file in the correct structure we use

We have a process in my company which may produce either a DOC file or a DOCX file. Both have the same contents, including, in particular, a linked image. When we open the DOC file in Writer, with the image at the correct relative path, we see the image. But if we open the DOCX file in Writer - we see an empty rectangle, without the image.

The attached file contains such a pair of DOC and DOCX files, and an image thez both link to.
Comment 1 Gabor Kelemen (allotropia) 2024-10-11 15:20:04 UTC
Confirming for the doc case with

Version: 25.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 4787fd4fc86230893a6da309f45964116b3a67df
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: hu-HU (hu_HU.UTF-8); UI: en-US
Calc: threaded

Image path in the Properties dialog appears as a concatenation of the current file path + the original path on the users machine D:\something + the image name

Docx should be the same, but I don't see the image as imported.
Comment 2 Regina Henschel 2024-10-13 22:40:48 UTC
I have tested it with a MS Office 365. I have created a document with linked image and saved it in doc-format.
I have opened the created doc-file in MS Office 365 and verified in File > Info > 'Edit Links to Files' that the image is indeed linked.
Then I save the file to docx-format in keeping compatibility.
Then I have opened the created doc-file in MS Office 365 again and now saved it without keeping compatibility.

I have opened the created files in LibreOffice 24.8.
The doc-file shows the image.
The docx-file without compatibility shows the image.
The docx-file with compatibility does not import the image.

The not-compatible docx file uses as pic:blipFill element in an a:graphic element and writes the target as absolute URL in the r:id element. 

The compatible docx file has the image in a w:pict element with VML child elements v:shapetype, v:shape and v:imagedata.

The compatible docx file has an additional information about the image in a w:instrText element. But that seems to be unrelated. After removing the according run and the related runs with w:fldChar element, the document still opens fine in Word. So removing does not harm. The image is still missing in LibreOffice after these removals.

Method getFragmentPathFromRelId(...) returns an empty string in case of an external target and thus mrTypeModel.moGraphicPath has an empty string in case VML_TOKEN(imagedata) in https://opengrok.libreoffice.org/xref/core/oox/source/vml/vmlshapecontext.cxx.

So implementation of external images is totally missing in case of VML.