Skip to content
This repository has been archived by the owner on Apr 16, 2022. It is now read-only.

"Word found unreadable content" warning when template file has text boxes #69

Open
joaoe opened this issue Jun 26, 2019 · 3 comments
Open

Comments

@joaoe
Copy link

joaoe commented Jun 26, 2019

Hi.

Context

My template document has a text box. The original document was an invitation in which the text box was used to mark the margin to cut them into the right size and to also specify a background image.

Current behavior

Generating the merge files seems to go ok and the final document has all the expected text. However, MS Word 2016 complains when first opening it:

Word found unreadable content in <...>.docx. Do you want to recover the contents of this document? If you trust the source o this document, click Yes.

The document is generated using MailMerge.merge_pages(...), e.g.:

merger = MailMerge("testcase.docx")
merger.merge_pages(foo="bar")
merger.write("testcase_generated.docx")

Expected Behavior

Hopefully that warning is not serious. Nonetheless, it should be investigated to see if the generated file is not broken or if we are getting lucky and Word manages to rebuild it.

Steps to Reproduce (for bugs)

  1. Download testcase.zip (link) and unzip in a file locally. The zip file contains testcase.docx and testcase.py.
  2. Run python testcase.py. Obviously this python instance should have docx-mailmerge installed.
  3. Open testcase_generated.docx with Word 2016
  4. The warning message should pop up immediately and block the whole MS Word window.

Environment

  • Python 3.7 on Cygwin
  • docx-mailmerge 0.4.0 (I just installd it fresh)
  • MS Word 2016 32 bits

Thank you !

@joaoe
Copy link
Author

joaoe commented Jun 27, 2019

I saved myself from this trouble by using instead a single cell table, with fixed dimensions and an inline image with layout set to behind text.

@joaoe
Copy link
Author

joaoe commented Jun 27, 2019

I see this here

When using this feature, make sure you don't use comments, footnotes, bookmarks, etc. This is because these elements have an id attribute, which must be unique. This library does not handle this, resulting in invalid documents.

Could it be the same issue ?

@tom1200
Copy link
Contributor

tom1200 commented Jul 30, 2019

Hi,
This is indeed related to text boxes, witch may have anchors, position, etc ; they are not managed by the merge_pages def.
Note that the documentation you quoted refers to a version not released yet by @Bouke. However, this version (def merge_pages replaced by def merge_templates) will not managed either text boxes for the same reasons.

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

No branches or pull requests

2 participants