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

merge_templates with blank tables causes rows from another table to be written instead #88

Open
cameronstubber opened this issue Nov 2, 2020 · 2 comments

Comments

@cameronstubber
Copy link

Expected Behavior

If I submit 3 sets of data to merge_templates, and only 1 contains table rows, I expect that only 1 of the pages should contain the table rows, not more than 1. I also expect where the table should be blank, that the table rows are actually blank.

Current Behavior

The item previous in the array of inputs seems to be given the next pages table rows, if the previous pages rows were empty.

Possible Solution

Possibly an indexing or pointer issue?

Steps to Reproduce (for bugs)

  1. Set up a merge_template with page data
  2. Ensure that only 1 page has table rows defined
  3. Run the script
  4. Observe that more than one page contains a duplicate of the table rows.

Context

I am trying to write an audit report, which validates parts used to be booked to jobs. The impact of this bug is that the wrong list of parts can appear on a job where it should have no parts (Like an Inspection).

Your Environment

  • Python version: 3.8
  • docx-mailmerge version: 0.5.0
@cameronstubber
Copy link
Author

Workaround:

it is possible to get around this issue by ensuring that all pages have at least 1 table row supplied. In the case of an empty table, simply create a row where the columns say NA or Empty or something similar.

@iulica
Copy link

iulica commented Mar 8, 2022

Can you provide a sample docx and merge_templates code ?

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