Excel 2010 complains when opening file with image

Issue #550 duplicate
Guillaume Leroux created an issue

Hello,
just trying to integrate the newer 2.3.0, I stumble upon a small complaint from my Excel 2010 French when basically doing the same thing as in 2.2.5.
I’m attaching xlsx result files, including the 2.3.0 as corrected by Excel, and the correction .xml report.

The .xlsx result of this code in 2.2.5 opens with no complaint:

from openpyxl import Workbook
from openpyxl.drawing import Image

wb = Workbook()
ws = wb.active
ws['A1'] = 'You should see three logos below'

# create an image
img = Image('logo.png')

# add to worksheet and anchor next to cells
ws.add_image(img)
wb.save('logo225.xlsx')

When opening the result of this using 2.3.0, Excel complains, see attached snapshots.

from openpyxl import Workbook
from openpyxl.drawing.image import Image

wb = Workbook()
ws = wb.active
ws['A1'] = 'You should see three logos below'

# create an image
img = Image('logo.png')

# add to worksheet and anchor next to cells
ws.add_image(img,'A1')
wb.save('logo230.xlsx')

Snapshot #1
2015-11-13 15_47_16-Microsoft Excel.png

Snapshot #2
2015-11-13 15_49_05-Réparations dans 'logo230.xlsx'.png

Comments (6)

  1. CharlieC

    Can you try with a checkout of the 2.3 branch? I think this contains a fix for this (the mime-type for image is missing from [content-types].xml)

  2. Guillaume Leroux reporter

    Never used hg. Is it mandatory to checkout & install the 2.3 branch or can I use git instead ? If yes how ? Thanks.

  3. CharlieC

    Assuming you have Mercurial installed you can just do it with pip: bin/pip install -e hg+https://bitbucket.org/openpyxl/openpyxl@2.3#egg=openpyxl

  4. Guillaume Leroux reporter

    Installed hg and ran the given 2.3 pip install command.

    The logo230.xlsx output does not trigger Excel complaints any more, and it’s the same with my own project. Thanks a lot for your timely response.

  5. Log in to comment