Open
Description
I'm using docx to open a template and add some content as a first page. I then want to use a different template for subsequent pages (different watermarks). I then want to save all pages in one document. Is this possible in python-docx?
this is how I'm creating my document
page_1.render(context)
out = StringIO()
page_1.save(out)
payload = out.getvalue()
filename = "proposal-%s-%s.docx" % (order.code, datetime.date.today())
response = HttpResponse(payload,
content_type="application/vnd.openxmlformats-officedocument.wordprocessingml.document")
response['Content-Disposition'] = 'attachment;filename="%s"' % filename
I'm wondering if I can add
other_pages.render(context)
out_2 = StringIO()
other_pages.save(out_2)
and then something like
payload = out.getvalue() + out_2.getvalue()
This creates a file but when I try to open it I get the message "this file is corrupt and cannot be opened"
Metadata
Metadata
Assignees
Labels
No labels