Skip to content

add_picture corruptes file in some case #455

Open
@Tores76

Description

@Tores76

Dear @scanny ,

First of all, thanks to you and all contributors for python-docx!

I have found a problem when I wanted to add images in an existing file. After the insertion the file resulted corrupted when opening it with MS Word.

I did some debugging I have found out that it was a clash between the id of the wp:docPr of the newly inserted image and the wp:docPr of a shape in the header.

I think that the problem is in next_id(self) of document.py that from my understanding looks only for the image ids in document.xml and not in header1.xml (where the conflicting wp:docPr is).
I have temporarily fixed it for my case by artificially increasing the id number of the newly inserted pictures by 10000 as I haven't find out as to access the header1.xml elements and I'm very short on time.

Again, thanks for this extremely useful package!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions