Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not compose a file with WPS insert a text box #77

Open
vba34520 opened this issue Feb 17, 2022 · 0 comments
Open

Can not compose a file with WPS insert a text box #77

vba34520 opened this issue Feb 17, 2022 · 0 comments

Comments

@vba34520
Copy link

First of all, thank you for your work!

Install

pip install docxcompose==1.3.4

Install WPS Office

Generate a Document

Insert a Text Box, and save as 1.docx

Code

from docx import Document
from docxcompose.composer import Composer

composer = Composer(Document())
composer.append(Document('1.docx'))
composer.save('result.docx')

It cause

Traceback (most recent call last):
  File "D:/mycode/test/1.py", line 5, in <module>
    composer.append(Document('1.docx'))
  File "C:\Users\Administrator\Envs\test\lib\site-packages\docxcompose\composer.py", line 51, in append
    self.insert(index, doc, remove_property_fields=remove_property_fields)
  File "C:\Users\Administrator\Envs\test\lib\site-packages\docxcompose\composer.py", line 76, in insert
    self.add_shapes(doc, element)
  File "C:\Users\Administrator\Envs\test\lib\site-packages\docxcompose\composer.py", line 190, in add_shapes
    img_part = doc.part.rels[rid].target_part
KeyError: None

Looking forward to your reply!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant