Impossible to link cells containing pictures to Word

Issue #1206 closed
Georges-Henri
created an issue

Using openpyxl 2.6.0, it seems to be impossible to link the generated Excel file to a Word document (paste and link). The Excel file generated using the attached script only contains one png image anchored to a cell. Linking to Word fails with the following: "Word cannot obtain the data for the {xxx-xxx-xxx-xxx} link. Digging into the Excel file generated by openpyxl, it seems that the embedded image does not have the same properties as when added with Excel directly (openpyxl misses some properties). I extracted the drawing.xml file of both Excel and openpyxl-generated files, in attachment.

Comments (4)

  1. CharlieC

    I'm not quite sure I understand what you want to do. The code does not contain any links. But, yes, support for DrawingML in openpyxl is limited.

  2. Georges-Henri reporter

    What I want to do is linking an Excel table to a Word document (using Word Paste & Link feature). Under normal conditions or manually made Excel file this works without issues, including pictures contained in the tables. If the Excel file is generated by openpyxl and contains embedded pictures, this no longer works because Word can't parse correctly the drawing xml file. It seems to lack some properties.

  3. CharlieC

    Sorry, but this is really a problem with MS Excel. openpyxl is a library for the file OOXML file format and produces valid OOXML files. There are different ways of embedding images in XLSX files but they are all valid.

  4. Log in to comment