0

I am using docxtpl library in Python to create new documents from a template (docx document too).

I create the document, add some data then a table:

from doxctpl import DocxTemplate

def add_table(boss_name, employee_name, created_by):
    sign_context = {
        'headers': ['', ''], # the table has 2 columns
        'company_data': [boss_name, 'Your Boss'],
        'employee_data': [employee_name, 'Employee'],
        'creator_data': ['Created by:  ', created_by]
    }
    return sign_context

...
template = DocxTemplate(template_file)
template.render(other_context)

template.render(add_table())

That way, the table render after the last paragraph, generally will be in the middle of the last pag, what I need is to assure is that the table is placed in the last lines of the last page, No matter about the white lines missing in the last page.

How can I assure the table will be always in the last 5 lines of the last page?

Thanks.

Juan Botero
  • 71
  • 1
  • 2
  • 12

0 Answers0